yade-users team mailing list archive
-
yade-users team
-
Mailing list archive
-
Message #02657
Re: ids bodies contact
Hi,
I find this totally obvious since you assign values of ids yourself.
Ids on Yade are assigned for evry body since the creation of your
specimen: walls(id = 0-->nbr_walls-1) and spheres
(id=nbr_walls-->nbr_bodies-1).
When two bodies come into contact you can display their ids as follow
(python):
import pylab
import numpy
ofile = open('contactforces','w')
ofile.write("id1 id2 nx ny nz fx fy fz FORCE \n")
axis=0 # (plot the yz plane)
x,y,z=(axis)%3,(axis+1)%3,(axis+2)%3
forces=[]
CompFn=0
Fnx,Fny,Fnz=(CompFn)%3,(CompFn+1)%3,(CompFn+2)%3
for j in O.interactions:
if not j.isReal: continue
norm=j.geom['normal']
FORCE=j.phys['normalForce'].Length()
force=j.phys['normalForce']
index1=j.id1
index2=j.id2
#angles.append(angle)
#forces.append(force)
if index1>5 and index2>5 : ### Only sphere-sphere contact###
angle_yz=atan2(norm[z],norm[y])
angle_xz=atan2(norm[z],norm[x])
angle_xy=atan2(norm[y],norm[x])
ofile.write('%g %g %g %g %g %g %g %g %g %g %g %g\n' %
(index1,index2,norm[x],norm[y],norm[z],force[Fnx],force[Fny],force[Fnz],FORCE))
ofile.close()
and of course this can tell the interactions at evry iteration!
Le mercredi 24 mars 2010 à 12:51 +0000, chiara modenese a écrit :
> Hi all,
>
> quick question on the ids of two bodies in contact. I took an example
> where a box and a sphere get in contact. Then I simply switched the id
> of the two and I checked the ids of the interaction. To put it better
> I obtained:
>
> 1) case
>
> box -> id=0
> sphere -> id=1
>
> Interaction:
> id1=0 (box)
> id2=1 (sphere)
>
> 2) case (I switch ids, alias I change the sequence in which I append
> the two bodies)
>
> sphere -> id=0
> box -> id=1
>
> Interaction:
> id1=1 (box) ---> why it is not id=0 as in the first case?
> id2=0 (sphere)
>
> My question is: how are assigned the ids of the contact once the
> interaction is created?
> Just to know..
>
> cheers, Chiara
>
>
> _______________________________________________
> 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
References