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

2013-03-01 Thread MOHAMMAD MOHSENI
Question #222563 on Yade changed:
https://answers.launchpad.net/yade/+question/222563

Status: Answered = Solved

MOHAMMAD MOHSENI confirmed that the question is solved:
Thanks Jan Stránský, that solved my question.

-- 
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@lists.launchpad.net
Unsubscribe : https://launchpad.net/~yade-users
More help   : https://help.launchpad.net/ListHelp


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

2013-02-28 Thread MOHAMMAD MOHSENI
Question #222563 on Yade changed:
https://answers.launchpad.net/yade/+question/222563

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.append(utils.geom.facetCylinder((.5,.5,.5),radius=0.5,height=1,segmentsNumber=30,
 wallMask=4))
cylIds=O.bodies.append(utils.geom.facetCylinder((.5,.5,.5),radius=0.6,height=0,wallMask=1))
sp=pack.SpherePack()
O.materials.append(FrictMat(density = 4000, 
frictionAngle=90,young=1e9,poisson=.11))
sp.makeCloud((0.3,0.3,-0.5),(0.75,0.75,-0.75),rMean=.05,rRelFuzz=0, num=20)
b=O.bodies.append(utils.sphere(center=(0.35,0.35,-0.1),radius=.10,fixed=False))

sp.toSimulation()

O.engines=[
ForceResetter(),
InsertionSortCollider([Bo1_Sphere_Aabb(),Bo1_Facet_Aabb()]),
InteractionLoop(
[Ig2_Sphere_Sphere_L3Geom(),Ig2_Facet_Sphere_L3Geom()],
[Ip2_FrictMat_FrictMat_FrictPhys()],
[Law2_L3Geom_FrictPhys_ElPerfPl()]

),
GravityEngine(gravity=(0,0,9.81)),
NewtonIntegrator(damping=0.4),
RotationEngine(rotateAroundZero=True,zeroPoint=(0.5,0.5,0.5),rotationAxis=(0,0,1),angularVelocity=1000*(2*pi/60),ids=cylIds),
PyRunner(iterPeriod = 10, command=plotAddData())

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

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 = numIntrsOfEachBody()
plot.addData( i=O.iter, x=pos[0], y=pos[1], z=pos[2] ,nIntrs=len(b.intrs()

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(script,globals())
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://launchpad.net/~yade-users
Post to : yade-users@lists.launchpad.net
Unsubscribe : https://launchpad.net/~yade-users
More help   : https://help.launchpad.net/ListHelp


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

2013-02-28 Thread Jan Stránský
Question #222563 on Yade changed:
https://answers.launchpad.net/yade/+question/222563

Status: Open = Answered

Jan Stránský proposed the following answer:
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=len(b.intrs()
should be
plot.addData( i=O.iter, x=pos[0], y=pos[1], z=pos[2] ,nIntrs=len(b.intrs()
) )

with the first error I don't know, I will try to find the solution.

cheers
Jan


2013/2/28 MOHAMMAD MOHSENI question222...@answers.launchpad.net

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

 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.append(utils.geom.facetCylinder((.5,.5,.5),radius=0.5,height=1,segmentsNumber=30,
 wallMask=4))

 cylIds=O.bodies.append(utils.geom.facetCylinder((.5,.5,.5),radius=0.6,height=0,wallMask=1))
 sp=pack.SpherePack()
 O.materials.append(FrictMat(density = 4000,
 frictionAngle=90,young=1e9,poisson=.11))
 sp.makeCloud((0.3,0.3,-0.5),(0.75,0.75,-0.75),rMean=.05,rRelFuzz=0, num=20)

 b=O.bodies.append(utils.sphere(center=(0.35,0.35,-0.1),radius=.10,fixed=False))

 sp.toSimulation()

 O.engines=[
 ForceResetter(),
 InsertionSortCollider([Bo1_Sphere_Aabb(),Bo1_Facet_Aabb()]),
 InteractionLoop(
 [Ig2_Sphere_Sphere_L3Geom(),Ig2_Facet_Sphere_L3Geom()],
 [Ip2_FrictMat_FrictMat_FrictPhys()],
 [Law2_L3Geom_FrictPhys_ElPerfPl()]

 ),
 GravityEngine(gravity=(0,0,9.81)),
 NewtonIntegrator(damping=0.4),

 RotationEngine(rotateAroundZero=True,zeroPoint=(0.5,0.5,0.5),rotationAxis=(0,0,1),angularVelocity=1000*(2*pi/60),ids=cylIds),
 PyRunner(iterPeriod = 10, command=plotAddData())

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

 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 = numIntrsOfEachBody()
 plot.addData( i=O.iter, x=pos[0], y=pos[1], z=pos[2] ,nIntrs=len(b.intrs()

 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(script,globals())
 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://launchpad.net/~yade-users
 Post to : yade-users@lists.launchpad.net
 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.

___
Mailing list: https://launchpad.net/~yade-users
Post to : yade-users@lists.launchpad.net
Unsubscribe : https://launchpad.net/~yade-users
More help   : https://help.launchpad.net/ListHelp


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

2013-02-28 Thread Christian Jakob
Question #222563 on Yade changed:
https://answers.launchpad.net/yade/+question/222563

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=len(b.intrs()

correct:

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

- 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://launchpad.net/~yade-users
Post to : yade-users@lists.launchpad.net
Unsubscribe : https://launchpad.net/~yade-users
More help   : https://help.launchpad.net/ListHelp


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

2013-02-28 Thread Jan Stránský
Question #222563 on Yade changed:
https://answers.launchpad.net/yade/+question/222563

Jan Stránský proposed the following answer:
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 question222...@answers.launchpad.net

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

 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=len(b.intrs()

 correct:

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

 - 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://launchpad.net/~yade-users
 Post to : yade-users@lists.launchpad.net
 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.

___
Mailing list: https://launchpad.net/~yade-users
Post to : yade-users@lists.launchpad.net
Unsubscribe : https://launchpad.net/~yade-users
More help   : https://help.launchpad.net/ListHelp


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

2013-02-28 Thread MOHAMMAD MOHSENI
Question #222563 on Yade changed:
https://answers.launchpad.net/yade/+question/222563

MOHAMMAD MOHSENI posted a new comment:
Ok , I will send the whole code to your Email (honzik.stran...@gmail.com )
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://launchpad.net/~yade-users
Post to : yade-users@lists.launchpad.net
Unsubscribe : https://launchpad.net/~yade-users
More help   : https://help.launchpad.net/ListHelp


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

2013-02-28 Thread Jan Stránský
Question #222563 on Yade changed:
https://answers.launchpad.net/yade/+question/222563

Jan Stránský proposed the following answer:
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 question222...@answers.launchpad.net

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

 MOHAMMAD MOHSENI posted a new comment:
 Ok , I will send the whole code to your Email (honzik.stran...@gmail.com )
 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://launchpad.net/~yade-users
 Post to : yade-users@lists.launchpad.net
 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.

___
Mailing list: https://launchpad.net/~yade-users
Post to : yade-users@lists.launchpad.net
Unsubscribe : https://launchpad.net/~yade-users
More help   : https://help.launchpad.net/ListHelp


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

2013-02-22 Thread Jan Stránský
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 question222...@answers.launchpad.net

 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@lists.launchpad.net
 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.

___
Mailing list: https://launchpad.net/~yade-users
Post to : yade-users@lists.launchpad.net
Unsubscribe : https://launchpad.net/~yade-users
More help   : https://help.launchpad.net/ListHelp


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

2013-02-22 Thread MOHAMMAD MOHSENI
Question #222563 on Yade changed:
https://answers.launchpad.net/yade/+question/222563

MOHAMMAD MOHSENI posted a new comment:
many Thanks for your comprehensive respond Jan , hope it works .

-- 
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@lists.launchpad.net
Unsubscribe : https://launchpad.net/~yade-users
More help   : https://help.launchpad.net/ListHelp