← Back to team overview

yade-users team mailing list archive

Re: [Question #222563]: tracking a sphere in a pack

 

Question #222563 on Yade changed:
https://answers.launchpad.net/yade/+question/222563

    Status: Open => Answered

Jan Stránský proposed the following answer:
Hello Mohammad,

for both your questions there is number of solutions. If you want to track
position of one particle, you can do it with plot module [1, 2]

b = O.bodies[idOfParticleYouWant]
def plotAddData():
  pos = b.state.pos
  plot.addData( i=O.iter, x=pos[0], y=pos[1], z=pos[2] )

...

O.engines = [
  ...
  PyRunner(iterPeriod = 10, command="plotAddData()"), # change iterPeriod
according to your requirements
]

after simulation, plot.data will be a dictionary looking like this:
{
  'i': [10,20,30,...],
  'x':[xPositionAtIter10, xPositionAtIter20, xPositionAtIter30, ... ],
  'y':[yPositionAtIter10, yPositionAtIter20, yPositionAtIter30, ... ],
  'z':[zPositionAtIter10, zPositionAtIter20, zPositionAtIter30, ... ],
}

Concerning number of interactions, if you want to get number of
interactions of one particle, you can do it like

nIntrs = len( b.intrs() ) # [3]

or for all particles

nIntrs = numIntrsOfEachBody() # [4]

you can add this information also to the plotAddData function:

plot.addData( i=O.iter, x=pos[0], y=pos[1], z=pos[2] ,nIntrs=len(b.intrs())
)

cheers
Jan

[1] https://yade-dem.org/doc/yade.plot.html
[2] https://yade-dem.org/doc/user.html#tracking-variables
[3] https://yade-dem.org/doc/yade.wrapper.html#yade.wrapper.Body.intrs
[4] https://yade-dem.org/doc/yade.utils.html#yade._utils.numIntrsOfEachBody


2013/2/22 MOHAMMAD MOHSENI <question222563@xxxxxxxxxxxxxxxxxxxxx>

> New question #222563 on Yade:
> https://answers.launchpad.net/yade/+question/222563
>
> Hi
>
> I have a sphere packing which falls into a cylinder whose base is
> rotating. I want to find a way in which I can track only one sphere from
> the packing and find number of interactions. Any suggestions?
>
> --
> You received this question notification because you are a member of
> yade-users, which is an answer contact for Yade.
>
> _______________________________________________
> Mailing list: https://launchpad.net/~yade-users
> Post to     : yade-users@xxxxxxxxxxxxxxxxxxx
> Unsubscribe : https://launchpad.net/~yade-users
> More help   : https://help.launchpad.net/ListHelp
>

-- 
You received this question notification because you are a member of
yade-users, which is an answer contact for Yade.