force chain between polyhedrons

Asked by Weimin Song

Dear all,

          I'm curious about the force chain output between polyhedrons in paraview.
          I find exportInteractions()[1] could output the interactions. By trying the code below, I got all the interactions.

          PyRunner(command="vtkExporter.exportInteractions('all')",iterPeriod=50)

         Now, I don't want the interaction between polyhedrons and facets, and just want the interactions between polyhedrons, could anyone give me some help how to write the code?

          Appreciate your help very much.

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
Weimin Song (wsong8) said :
#1
Revision history for this message
Jan Stránský (honzik) said :
#2

Hi Weimin,

to visualize force chain, see [1].

to export only some interactions, use
exportInteractions(ids=intrs)
where intrs is list of (id1,id2) tuples to export. Try something like:

intrs = []
for i in O.interactions:
   b1 = O.bodies[i.id1]
   b2 = O.bodies[i.id2]
   if isisntance(b1.shape,Polyhedra) and isinstance(b2.shape,Polyhedra):
      ints.append((i.id1,i.id2))

cheers
Jan

[1]
https://github.com/yade/trunk/blob/master/doc/sphinx/user.rst#rendering-interactions-as-force-chain

Revision history for this message
Weimin Song (wsong8) said :
#3

Thank you, Jan.

I tried the code below, however, it doesn't work. Could you explain your approach in more detail?

def myFunction():
       intrs = []
       for i in O.interactions:
             b1 = O.bodies[i.id1]
             b2 = O.bodies[i.id2]
             if isinstance(b1.shape,Polyhedra) and isinstance(b2.shape,Polyhedra):
                 intrs.append((i.id1,i.id2))
                 vtkExporter.exportInteractions(ids=intrs)

...
O.engines=[
       ForceResetter(),
       InsertionSortCollider(...),
       InteractionLoop(...),
       NewtonIntegrator(...),
       PyRunner(command='myFunction()',iterPeriod=50),
]

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

Hi Weimin,

please always specify what does not work. "I tried the code below, however,
it doesn't work" is completely useless information :-) especially without a
complete script..

I tried the following script and it works as expected

######################################################################
from yade import plot, polyhedra_utils

O.materials.append(PolyhedraMat())
mat = O.materials[0]

O.bodies.append(wall(0,axis=2,sense=1))
O.bodies.append(wall(0,axis=1,sense=1))
O.bodies.append(wall(0,axis=0,sense=1))
O.bodies.append(wall(0.3,axis=1,sense=-1))
O.bodies.append(wall(0.3,axis=0,sense=-1))

polyhedra_utils.fillBox((0,0,0),
(0.3,0.3,0.3),mat,sizemin=[0.05,0.05,0.05],sizemax=[0.1,0.1,0.1],seed=4)

O.engines=[
   ForceResetter(),

 InsertionSortCollider([Bo1_Polyhedra_Aabb(),Bo1_Wall_Aabb(),Bo1_Facet_Aabb()]),
   InteractionLoop(
      [Ig2_Wall_Polyhedra_PolyhedraGeom(),
Ig2_Polyhedra_Polyhedra_PolyhedraGeom(),
Ig2_Facet_Polyhedra_PolyhedraGeom()],
      [Ip2_PolyhedraMat_PolyhedraMat_PolyhedraPhys()],
      [Law2_PolyhedraGeom_PolyhedraPhys_Volumetric()]
   ),
   NewtonIntegrator(damping=0.3,gravity=(0,0,-9.81)),
   PyRunner(iterPeriod=100,command="print O.iter"),
]

O.dt = 1e-3
O.run(2000,True)

from yade import export
export.VTKExporter('/tmp/exportpoly-all').exportInteractions() # ids='all'
is default
intrs = []
for i in O.interactions:
   b1 = O.bodies[i.id1]
   b2 = O.bodies[i.id2]
   if isinstance(b1.shape,Polyhedra) and isinstance(b2.shape,Polyhedra):
      intrs.append((i.id1,i.id2))
export.VTKExporter('/tmp/exportpoly-poly').exportInteractions(ids=intrs)
######################################################################

cheers
Jan

Revision history for this message
Weimin Song (wsong8) said :
#5

Thanks Jan Stránský, that solved my question.