start an engine at a certain time

Asked by jamespaul

Hi,

I want to add HarmonicMotionEngine(A=[0,0,0.01],f=[0,0,20.0],ids=Cylinder) when the simulation runs to 2 seconds.How can I do it?

Using O.engines += ?

Thanks,

Feng

###################
Cylinder=O.bodies.append(geom.facetCylinder(center=(0.0,0.0,1),radius=0.18,height=1,wallMask=7,segmentsNumber=20,color=(1,0,0),material='sphere'))

O.engines=[
   ForceResetter(),
   InsertionSortCollider([Bo1_Sphere_Aabb(),Bo1_Facet_Aabb()]),
   InteractionLoop(
      [Ig2_Sphere_Sphere_ScGeom(),Ig2_Facet_Sphere_ScGeom()],
      [Ip2_FrictMat_FrictMat_FrictPhys()],
      [Law2_ScGeom_FrictPhys_CundallStrack()]
   ),
   NewtonIntegrator(gravity=(0,0,-9.81),damping=0.1),
    ]

Question information

Language:
English Edit question
Status:
Solved
For:
Yade Edit question
Assignee:
No assignee Edit question
Solved by:
Jérôme Duriez
Solved:
Last query:
Last reply:
Revision history for this message
Best Jérôme Duriez (jduriez) said :
#1

Hi,

O.engines can be accessed/modified (or read/write accessed) at any time of the simulation, it just depends on the user (to access it whenever he/she wants).

You just need to follow the rules at https://yade-dem.org/doc/user.html#base-engines, which is what you do here.

You may check it yourself

O.engines
O.engines += [HarmonicMotionEngine(A=[0,0,0.01],f=[0,0,20.0],ids=[0])] # so that you can copy paste this example outside of your script, change the ids attribute if you want to tailor it to your particular scrit.....
O.engines # you will see the added engine

Jérôme

Revision history for this message
Jérôme Duriez (jduriez) said :
#2

(and if the question was: how do I know my simulation has been running for 2 seconds, see O.time / O.realtime)

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

Hello,

a) either using O.engines+=
b) or adding the engine to O.engines intially with dead=True and setting dead=False after desired time

**I personally** would prefer b)

cheers
Jan

Revision history for this message
jamespaul (jamespauljames) said :
#4

Thanks Jérôme Duriez, that solved my question.