Deleting the desired interactions

Asked by Xavier Thurman

Dear users of YADE,

I created two BPMs using cohesive elements in YADE. The two BPMs were allocated two different materials but some undesired bonds were created at their interacting interface. Thus, How can I delete those additional bonds which made the two BPMs a body rather two separated bodies.
Thanks in advance,

Xavier

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
Jan Stránský (honzik) said :
#1

Hello Xavier,
O.interactions.erase [1] is what you are looking for. The deletion will be applied after O.step()
cheers
Jan

[1] https://yade-dem.org/doc/yade.wrapper.html#yade.wrapper.InteractionContainer.erase

Revision history for this message
Xavier Thurman (xavierthurman) said :
#2

Thanks Jan,

I have tried this method.
I allocated two different colors for those two BPMs. I have the following codes:
O.step()
for i in O.interactions:
     if O.bodies[i.id1].shape.color != O.bodies[i.id2].shape.color:
            O.interactions.erase(i.id1,i.id2)

But it does not work!
Xavier

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

Have you run O.step() afterwards? If yes, please put here a MWE [1]
thanks
Jan

[1] https://yade-dem.org/wiki/Howtoask

Revision history for this message
Jérôme Duriez (jduriez) said :
#4

Hello,

YADE is a very good computer program in the sense it always does what you're asking him to do (as every computer program..).
I'd thus advice

- to check your test (if it is properly written, it will run and the interaction will be deleted)

- to check whether your interaction is not re-created just (one step..) after it has been deleted

- to consider whether you could just zero the cohesive properties of these interactions (instead of erasing the interaction altogether), cancelling e.g. i.phys.FnMax and FsMax [*] assumping a interaction physics of JCFpmPhys type.

Jérôme

[*] https://yade-dem.org/doc/yade.wrapper.html?highlight=jcfpmphys#yade.wrapper.JCFpmPhys.FnMax and just below

Revision history for this message
Xavier Thurman (xavierthurman) said :
#5

Here is my codes:
from yade import pack

porosity = 0.3042744476
Young = 1.0e11 # 100Gpa
FrictAng = radians(18)
Density = 2640/(1-porosity)
Poisson = 1/3.0
Cohesion = 4.5e7 # pa
TensileStr = 4.5e6 # pa

rock = JCFpmMat(young=Young,frictionAngle=FrictAng,density=Density,poisson=Poisson,tensileStrength=TensileStr,cohesion=Cohesion)
steel = JCFpmMat(young=2.06e11,frictionAngle=radians(30),density=7800,poisson=0.3,tensileStrength=0,cohesion=0)

pred1 = pack.inAlignedBox((0,0,0),(0.01,0.01,0.01))
pred2 = pack.inAlignedBox((0,0,0.01),(0.01,0.01,0.02))

assembly1 = pack.randomDensePack(pred1,radius=0.0005,spheresInCell=1000,color=(1,1,1),material=rock)
O.bodies.append(assembly1)
assembly2 = pack.randomDensePack(pred2,radius=0.0005,spheresInCell=1000,color=(1,1,0),material=rock)
O.bodies.append(assembly2)

O.engines=[
 ForceResetter(),
 InsertionSortCollider([Bo1_Sphere_Aabb(aabbEnlargeFactor=1.5),Bo1_Facet_Aabb()]),
 InteractionLoop(
  [Ig2_Sphere_Sphere_ScGeom(interactionDetectionFactor=1.5),Ig2_Facet_Sphere_ScGeom()],
  [Ip2_JCFpmMat_JCFpmMat_JCFpmPhys()],
  [Law2_ScGeom_JCFpmPhys_JointedCohesiveFrictionalPM(recordCracks=True,label='lawFunctor')]
 ),
 VTKRecorder(fileName='post/scp-',recorders=['all'],iterPeriod=50),
 GlobalStiffnessTimeStepper(active=1,timeStepUpdateInterval=5,timestepSafetyCoefficient=0.8,defaultDt=PWaveTimeStep()),
 NewtonIntegrator(damping=0.3,gravity=(0,0,-9.81)),

]
O.trackEnergy=True
O.step()

print len(O.interactions)

for i in O.interactions:
 if O.bodies[i.id1].shape.color != O.bodies[i.id2].shape.color:
  O.interactions.erase(i.id1,i.id2)

O.step()

print len(O.interactions)

from yade import qt
qt.View()
qt.Controller()

Thanks for your patience,
Xavier

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

Thanks for the code, it is much clearer now :-) you have to cancel the enlargements after the first O.step:
###
O.engines=[
        ForceResetter(),
        InsertionSortCollider([Bo1_Sphere_Aabb(aabbEnlargeFactor=1.5,label='bo1'),......
        InteractionLoop(
                [Ig2_Sphere_Sphere_ScGeom(interactionDetectionFactor=1.5,label='ig2'),....
   ....
]
O.trackEnergy=True
O.step()
bo1.aabbEnlargeFactor = 1. # !!
ig2.interactionDetectionFactor = 1. # !!
...
###

also note that len(O.interactions) and len([i for i in O.interactions]) may differ
len(O.interactions) ... includes also potential interactions
len([i for i in O.interactions]) ... only counts real interactions

cheers
Jan

Revision history for this message
Xavier Thurman (xavierthurman) said :
#7

Dear Jan,

I just tried your method, but it still can not delete the bonds between two BPMs.

Xavier

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

Hello Xavier,
please try the following code. In the GUI on display tab, I checked intrAllWire and do not see any bonds between the two cubes. What version of Yade you use and what system? This works for me for Ubuntu 16.04 and yade-1.20.0.

###
from yade import pack

porosity = 0.3042744476
Young = 1.0e11 # 100Gpa
FrictAng = radians(18)
Density = 2640/(1-porosity)
Poisson = 1/3.0
Cohesion = 4.5e7 # pa
TensileStr = 4.5e6 # pa

rock = JCFpmMat(young=Young,frictionAngle=FrictAng,density=Density,poisson=Poisson,tensileStrength=TensileStr,cohesion=Cohesion)
steel = JCFpmMat(young=2.06e11,frictionAngle=radians(30),density=7800,poisson=0.3,tensileStrength=0,cohesion=0)

pred1 = pack.inAlignedBox((0,0,0),(0.01,0.01,0.01))
pred2 = pack.inAlignedBox((0,0,0.01),(0.01,0.01,0.02))

assembly1 = pack.randomDensePack(pred1,radius=0.0005,spheresInCell=1000,color=(1,1,1),material=rock)
O.bodies.append(assembly1)
assembly2 = pack.randomDensePack(pred2,radius=0.0005,spheresInCell=1000,color=(1,1,0),material=rock)
O.bodies.append(assembly2)

O.engines=[
   ForceResetter(),
   InsertionSortCollider([Bo1_Sphere_Aabb(aabbEnlargeFactor=1.5,label='bo1'),Bo1_Facet_Aabb()]),
   InteractionLoop(
      [Ig2_Sphere_Sphere_ScGeom(interactionDetectionFactor=1.5,label='ig2'),Ig2_Facet_Sphere_ScGeom()],
      [Ip2_JCFpmMat_JCFpmMat_JCFpmPhys()],
      [Law2_ScGeom_JCFpmPhys_JointedCohesiveFrictionalPM(recordCracks=True,label='lawFunctor')]
   ),
   VTKRecorder(fileName='post/scp-',recorders=['all'],iterPeriod=50),
   GlobalStiffnessTimeStepper(active=1,timeStepUpdateInterval=5,timestepSafetyCoefficient=0.8,defaultDt=PWaveTimeStep()),
   NewtonIntegrator(damping=0.3,gravity=(0,0,-9.81)),

]
O.trackEnergy=True
O.step()
bo1.aabbEnlargeFactor = 1.
ig2.interactionDetectionFactor = 1.

print len(O.interactions), len([i for i in O.interactions])

for i in O.interactions:
   if O.bodies[i.id1].shape.color != O.bodies[i.id2].shape.color:
      O.interactions.erase(i.id1,i.id2)
O.step()

print len(O.interactions), len([i for i in O.interactions])
###

cheers
Jan

Revision history for this message
Xavier Thurman (xavierthurman) said :
#9

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