Contact number estimation

Asked by Nait

Hi,

I have a question about the contact number here.

Can I estimate the number of contact for each particle in a package?
Or how can we select the particles does not contact with any other particles? (can I call them free particles?)

Thanks

Nait

Question information

Language:
English Edit question
Status:
Solved
For:
Yade Edit question
Assignee:
No assignee Edit question
Solved by:
Nait
Solved:
Last query:
Last reply:
Revision history for this message
Chiara Modenese (chiara-modenese) said :
#1

Hi Nait,

If you are looking for the number of interactions of a specific body (say body with id 0), then you can type this:

O.bodies[0].intrs

If instead you want the average number of contacts you can call this (please see the relevant documentation for more explanations on this function):

utils.avgNumInteractions()
(see https://yade-dem.org/doc/yade.utils.html#yade.utils.avgNumInteractions)

HTH,
Chiara

Revision history for this message
Nait (xuhero1989) said :
#2

To Chiara,

Thanks for your answer, actually I am looking for the number of interaction of a specific body.
But as I type in

O.bodies[id_of_body].intrs

YADE would return something like

<bound method Body.intrs of <Body instance at 0xb41b968>>

And as mentioned in the YADE document,
"intrs() → list
Return all interactions in which this body participates."

I still don't understand how to obtain the number of contact of the specific body. Can you explain more?

Thanks.

Nait

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

Hi Nait,

nIntrsOfBodyId = len(O.bodies[bodyId].intrs())

hoe often do you plan to use this method? As I remember, in the
implementation is such that there is loop over all interactions, so if you
want to use it for one specific body, it is ok, but if you want to use it
for all bodies, it would be inefficient and maybe there is another method
or we can add some.

Jan

2012/10/31 Nait <email address hidden>

> Question #212834 on Yade changed:
> https://answers.launchpad.net/yade/+question/212834
>
> Status: Answered => Open
>
> Nait is still having a problem:
> To Chiara,
>
> Thanks for your answer, actually I am looking for the number of
> interaction of a specific body.
> But as I type in
>
> O.bodies[id_of_body].intrs
>
> YADE would return something like
>
> <bound method Body.intrs of <Body instance at 0xb41b968>>
>
> And as mentioned in the YADE document,
> "intrs() → list
> Return all interactions in which this body participates."
>
> I still don't understand how to obtain the number of contact of the
> specific body. Can you explain more?
>
> Thanks.
>
> Nait
>
> --
> 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 : <email address hidden>
> Unsubscribe : https://launchpad.net/~yade-users
> More help : https://help.launchpad.net/ListHelp
>

Revision history for this message
Chiara Modenese (chiara-modenese) said :
#4

Hi Nait,

Here is a simple example.

ii=O.bodies[id].intrs() # list of interactions with body id
len(ii) # number of interactions to which body id participates

I hope this is clear now.
Best,
Chiara

Revision history for this message
Nait (xuhero1989) said :
#5

To Chiara,

It is clear now, thanks for answering my question.

To Jan,

I want to check the number of interactions of all bodies in a package.

Nait

Revision history for this message
jessica sjah (jessica-sjah) said :
#6

Hi all,
I just want to know how to get the id of the all body which has a contact with a specific body?

thank you

Revision history for this message
Christian Jakob (jakob-ifgt) said :
#7

Hi jessica,

> I just want to know how to get the id of the all body which has a contact with a specific body?

body_id = ... #this is your part

for i in O.bodies[body_id].intrs(): # get all interactions from body with body_id
  if (i.geom.penetrationDepth > 0): # to get sure bodies are overlapping
    id1 = i.id1
    id2 = i.id2
    if id1 == body_id:
      print id2
    else:
      print id1

I hope this is working, I did not test ...

Regards,

Christian.

Revision history for this message
jessica sjah (jessica-sjah) said :
#8

it works well, Christian.
Thank you for your reply. It helps me :)

jessica