How to get the informations of interaction between polyhedras?

Asked by De zhang on 2019-06-12

Hi,
During the simulation of the interactions between two polyhedrons or one polyhedron and wall, I want to detect the equivalent CrossSection, penetration Volume and depth, contact point between them. I tried wrapper of PolyhedraGeom() such as contactPoint, equivalentCrossSection, penetrationVolume and something else, but it returned nothing for that. Please tell me how to get these informations during the simulation.

Following are the simple example for two polyhedrons contact:
####################################
from yade import pack,export
from yade import polyhedra_utils
from yade import geom,utils,ymport
from yade import qt
from yade import *

matP = PolyhedraMat()
matP.density = 2500 #kg/m^3
matP.young = 3e8
matP.poisson = 0.21 # real 0.21
matP.frictionAngle = 0.65

O.materials.append(matP)

matW = PolyhedraMat()
matW.density = 1950 #kg/m^3
matW.young = 6e7
matW.poisson = 0.33 # real 0.21
matW.frictionAngle = 0.23

O.materials.append(matW)

b1 = polyhedra_utils.polyhedra(matP,size=(0.046,0.046,0.046),seed=4)
b1.state.pos=(0.2,0.2,0.46)
O.bodies.append(b1)

b2=polyhedra_utils.polyhedra(matW,v=((0,0,0.35),(0.4,0,0.35),(0.4,0.4,0.35),(0,0.4,0.35),(0,0,0.4),(0.4,0,0.4),(0.4,0.4,0.4),(0,0.4,0.4)),fixed=True, color=(0.75,0.65,0.65))
O.bodies.append(b2)
O.bodies[1].state.blockedDOFs='xyzXYZ'

O.forces.setPermF(O.bodies[0].id,(0,0,-100))

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(),Ig2_Sphere_Sphere_ScGeom()],
  [Ip2_PolyhedraMat_PolyhedraMat_PolyhedraPhys(),Ip2_FrictMat_PolyhedraMat_FrictPhys(),Ip2_FrictMat_FrictMat_FrictPhys()],
  [Law2_PolyhedraGeom_PolyhedraPhys_Volumetric()],
 ),
 NewtonIntegrator(damping=0.7,gravity=(0,0,-9.81),label='newton'),
 #PyRunner(command='IniBalance()',iterPeriod=1,label='step')
]

O.dt = 0.000001

O.pause()

qt.Controller()
V = qt.View()
V.screenSize = (550,450)
V.sceneRadius = 1
V.eyePosition = (0.7,0.5,0.1)
V.upVector = (0,0,1)
V.lookAt = (0.15,0.15,0.1)

#########################

Thanks a lot
best regard!
Dez

Question information

Language:
English Edit question
Status:
Solved
For:
Yade Edit question
Assignee:
No assignee Edit question
Solved by:
Jan Stránský
Solved:
2019-06-12
Last query:
2019-06-12
Last reply:
2019-06-12
De zhang (dzlearnyade) said : #1

When I pause the process of simulation, I tried "PolyhedraGeom().contactPoint" it return the Vector3(0,0,0) and "PolyhedraGeom().penetrationVolume" was also tried with the result of "Nan", so how to get above informations?
Thanks

Best Jan Stránský (honzik) said : #2

Hello,

> PolyhedraGeom().contactPoint" ... and "PolyhedraGeom().penetrationVolume

PolyhedraGeom() creates new instance, with no relation to any existing interactions. Do something like:
###
for i in O.interactions:
   pv = i.geom.penetrationVolume
   cp = i.geom.contactPoint
###
or
###
i = O.interactions[id1,id2]
i.geom.whatever
###

cheers
Jan

De zhang (dzlearnyade) said : #3

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