tracking a sphere in a pack
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?
Question information
- Language:
- English Edit question
- Status:
- Solved
- For:
- Yade Edit question
- Assignee:
- No assignee Edit question
- Solved by:
- Jan Stránský
- Solved:
- Last query:
- Last reply:
Revision history for this message
|
#1 |
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[
def plotAddData():
pos = b.state.pos
plot.addData( i=O.iter, x=pos[0], y=pos[1], z=pos[2] )
...
O.engines = [
...
PyRunner(
according to your requirements
]
after simulation, plot.data will be a dictionary looking like this:
{
'i': [10,20,30,...],
'x':[
'y':[
'z':[
}
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 = numIntrsOfEachB
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=
)
cheers
Jan
[1] https:/
[2] https:/
[3] https:/
[4] https:/
2013/2/22 MOHAMMAD MOHSENI <email address hidden>
> New question #222563 on Yade:
> https:/
>
> 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:/
> Post to : <email address hidden>
> Unsubscribe : https:/
> More help : https:/
>
Revision history for this message
|
#2 |
many Thanks for your comprehensive respond Jan , hope it works .
Revision history for this message
|
#3 |
Dear Jan
I changed the code as you said but still have errors , can you please kindley help me with this
from yade import pack, plot
O.bodies.
cylIds=
sp=pack.
O.materials.
sp.makeCloud(
b=O.bodies.
sp.toSimulation()
O.engines=[
ForceResetter(),
InsertionSortCo
InteractionLoop(
[Ig2_Sphere_
[Ip2_FrictMat_
[Law2_L3Geom_
),
GravityEngine(
NewtonIntegrato
RotationEngine(
PyRunner(iterPeriod = 10, command=
]
O.dt=.5*
def plotAddData():
pos = b.state.pos
plot.addData( i=O.iter, x=pos[0], y=pos[1], z=pos[2] )
nIntrs = len( b.intrs() )
nIntrs = numIntrsOfEachB
plot.addData( i=O.iter, x=pos[0], y=pos[1], z=pos[2] ,nIntrs=
The Error we are getting is
1. For tracking the partcle p
NameError Traceback (most recent call last)
<string> in <module>()
NameError: name 'plotAddData' is not defined
2. For number of interactions
Traceback (most recent call last):
File "/usr/bin/yade", line 172, in runScript
execfile(
File "plotandint.py", line 37
^
SyntaxError: invalid syntax
Many thanks
Revision history for this message
|
#4 |
hi,
from your script i see some problems.
i am not sure, if this solves all errors ...
for 1. :
wrong:
def plotAddData():
pos = b.state.pos
plot.addData( i=O.iter, x=pos[0], y=pos[1], z=pos[2] )
correct:
def plotAddData():
pos = b.state.pos
plot.addData( i=O.iter, x=pos[0], y=pos[1], z=pos[2] )
-> you forgot indents
for 2. :
wrong:
plot.addData( i=O.iter, x=pos[0], y=pos[1], z=pos[2] ,nIntrs=
correct:
plot.addData( i=O.iter, x=pos[0], y=pos[1], z=pos[2] ,nIntrs=
-> you forgot ")"
regards,
christian
Revision history for this message
|
#5 |
Hi Mohammad,
if you wrote to the email complete code, the second error is because of
missing final braces:
plot.addData( i=O.iter, x=pos[0], y=pos[1], z=pos[2] ,nIntrs=
should be
plot.addData( i=O.iter, x=pos[0], y=pos[1], z=pos[2] ,nIntrs=
) )
with the first error I don't know, I will try to find the solution.
cheers
Jan
2013/2/28 MOHAMMAD MOHSENI <email address hidden>
> Question #222563 on Yade changed:
> https:/
>
> Status: Answered => Open
>
> MOHAMMAD MOHSENI is still having a problem:
> Dear Jan
>
> I changed the code as you said but still have errors , can you please
> kindley help me with this
>
> from yade import pack, plot
>
> O.bodies.
> wallMask=4))
>
> cylIds=
> sp=pack.
> O.materials.
> frictionAngle=
> sp.makeCloud(
>
> b=O.bodies.
>
> sp.toSimulation()
>
> O.engines=[
> ForceResetter(),
> InsertionSortCo
> InteractionLoop(
> [Ig2_Sphere_
> [Ip2_FrictMat_
> [Law2_L3Geom_
>
> ),
> GravityEngine(
> NewtonIntegrato
>
> RotationEngine(
> PyRunner(iterPeriod = 10, command=
>
> ]
> O.dt=.5*
>
> def plotAddData():
> pos = b.state.pos
> plot.addData( i=O.iter, x=pos[0], y=pos[1], z=pos[2] )
>
> nIntrs = len( b.intrs() )
> nIntrs = numIntrsOfEachB
> plot.addData( i=O.iter, x=pos[0], y=pos[1], z=pos[2] ,nIntrs=
>
> The Error we are getting is
>
> 1. For tracking the partcle p
>
> NameError Traceback (most recent call last)
> <string> in <module>()
>
> NameError: name 'plotAddData' is not defined
>
> 2. For number of interactions
>
> Traceback (most recent call last):
> File "/usr/bin/yade", line 172, in runScript
> execfile(
> File "plotandint.py", line 37
>
> ^
> SyntaxError: invalid syntax
>
>
> Many thanks
>
> --
> You received this question notification because you are a member of
> yade-users, which is an answer contact for Yade.
>
> _______
> Mailing list: https:/
> Post to : <email address hidden>
> Unsubscribe : https:/
> More help : https:/
>
Revision history for this message
|
#6 |
I supposed that indents were missing from copy-paste process.. the function
plotAddData work and did not result in SyntaxError, but I don't know yet
how to solve the NameError..
Jan
2013/2/28 Christian Jakob <email address hidden>
> Question #222563 on Yade changed:
> https:/
>
> Christian Jakob posted a new comment:
> hi,
>
> from your script i see some problems.
> i am not sure, if this solves all errors ...
>
> for 1. :
>
> wrong:
>
> def plotAddData():
> pos = b.state.pos
> plot.addData( i=O.iter, x=pos[0], y=pos[1], z=pos[2] )
>
> correct:
>
> def plotAddData():
> pos = b.state.pos
> plot.addData( i=O.iter, x=pos[0], y=pos[1], z=pos[2] )
>
> -> you forgot indents
>
>
> for 2. :
>
> wrong:
>
> plot.addData( i=O.iter, x=pos[0], y=pos[1], z=pos[2]
> ,nIntrs=
>
> correct:
>
> plot.addData( i=O.iter, x=pos[0], y=pos[1], z=pos[2]
> ,nIntrs=
>
> -> you forgot ")"
>
>
> regards,
>
> christian
>
> --
> You received this question notification because you are a member of
> yade-users, which is an answer contact for Yade.
>
> _______
> Mailing list: https:/
> Post to : <email address hidden>
> Unsubscribe : https:/
> More help : https:/
>
Revision history for this message
|
#7 |
Ok , I will send the whole code to your Email (<email address hidden> )
Thanks for your helps
Revision history for this message
|
#8 |
Hello Mohammad,
just in case somebody else (or in the future) found this information useful:
in the simulation script, you have to run at least one simulaton step,
afterwards IPython works ok, otherwise not.
Cheers
Jan
2013/2/28 MOHAMMAD MOHSENI <email address hidden>
> Question #222563 on Yade changed:
> https:/
>
> MOHAMMAD MOHSENI posted a new comment:
> Ok , I will send the whole code to your Email (<email address hidden> )
> Thanks for your helps
>
> --
> You received this question notification because you are a member of
> yade-users, which is an answer contact for Yade.
>
> _______
> Mailing list: https:/
> Post to : <email address hidden>
> Unsubscribe : https:/
> More help : https:/
>
Revision history for this message
|
#9 |
Thanks Jan Stránský, that solved my question.