yade-users team mailing list archive
-
yade-users team
-
Mailing list archive
-
Message #09156
[Question #245380]: Detect newly appear contacts between two states of the same model
New question #245380 on Yade:
https://answers.launchpad.net/yade/+question/245380
Hello everybody,
I want to ask a question about contact detection of two different states of the same specimen. Here is my problem:
I have a saved model, named 'begin.xml', from this specimen, I apply a force and after certain number of iterations, I have the specimen named 'end.xml'.
I want to detect the different interactions in 'begin.xml' and 'end.xml', I sort them into 3 types:
1. Permanent interactions: interaction that stays the same from 'begin' to 'end'
2. Newly formed interactions: interaction that is not available in 'begin', but appears in 'end'
3. Lost interactions: interaction that once was in 'begin' but in 'end' it's no longer available.
And based on that sorting method, I want to extract information from those bodies like positions and forces of the both 'base' and 'end' state. (position as x1, x2 and force as f, if interaction is not available, f=0)
Here is what I drafted for my idea:
O.load('end')
for i in O.interactions:
x_1_end=O.bodies[i.id1].state.pos
x_2_end=O.bodies[i.id2].state.pos
f_end=i.phys.normalForce+i.phys.shearForce
O.load('begin')
for j in O.interactions:
if j.id1==i.id1 and j.id2==i.id2: # condition of the permanent interaction
x_1_begin=O.bodies[j.id1].state.pos
x_2_begin=O.bodies[j.id2].state.pos
f_begin=j.phys.nomalForce + j.phys.shearForce
Till this point, this certainly handles the permanent interactions but I don't know how to continue with the lost and new interactions between 'begin' and 'end'. Maybe I might continue my script as:
elif j.id1==i.id1 and j.id2!=i.id2:
x_1_begin=O.bodies[j.id1].state.pos
x_2_begin=O.bodies[j.id2].state.pos
f_begin=j.phys.normalForce+i.phys.shearForce # of f=0 depends on 'new' or 'lost' conception
elif j.id1!=i.id1 and j.id2==i.id2:...
else:
continue
But I'm not sure this should work (the condition seems silly but I haven't found another better one). So I have questions:
1. How to effectively discriminate those three types of interaction between two states I mentioned above. Most of all the *newly formed interaction* and the *lost interaction*.
2. In which manner YADE sorts the interactions when we loop all over them, I do:
for i in O.interactions:
print i.id1, i.id2
and I see the list is quite in random order, but I do the script again and list is still the same so I convince myself that YADE is using certain sorting method for such looping, is that true? Can you enlighten me on this point?
Thanks in advance!
--
You received this question notification because you are a member of
yade-users, which is an answer contact for Yade.