Finding where a bond broke

Asked by mrhappy on 2020-02-20


In my model, I have 3D spheres aligned in the x-y plane (100 by 100). Each sphere is bonded with its neighboring spheres. There is a precrack in the model and I am applying a force field within the precrack. Once the model runs, the crack opens up and starts to propagate. Within the simulation I want to do the following:

If a new bond breaks:
        El1 = #element#1;
        El2 = #element#2;

I hope you understand. Basically, once a bond breaks, I want to apply a force on the 2 element that the bond broke between. I know that I have to write a function script. If you can just tell me how to get the if condition activated once a new bond breaks and how to get the element numbers, that would be off great help.


    GlobalStiffnessTimeStepper(active=1,timeStepUpdateInterval=10,timestepSafetyCoefficient=0.5, defaultDt=utils.PWaveTimeStep()),
    NewtonIntegrator(damping= 0.80),

Question information

English Edit question
Yade Edit question
No assignee Edit question
Solved by:
Last query:
Last reply:
Robert Caulk (rcaulk) said : #1

I guess you could keep a list of non-cohesive interaction IDs. Get a new list of non-cohesive interaction ids at each time step and compare the two lists. Any ID that is on the new list is a newly broken bond. Then you can apply your force logic to the bodies associated with that bond.

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

Just a performance hint, use python set (not list) for this kind of task. In your case, storing (i.id1,i.id2) tuple into the set should perform well. You can then easily do set difference to find broken bonds.

Robert Caulk (rcaulk) said : #3

Good to know, Jan ;-)

mrhappy (mrhappy) said : #4

Thank you guys!
I will try it now.

Robert Caulk (rcaulk) said : #5

Would love to see your final solution posted to this thread for future users ;-)

mrhappy (mrhappy) said : #6

Here is my final solution:
#SET This stores all connections. 1 means intact and 0 means broken.
Connectivity = [[5000, 4900, 1],
[5001, 4901, 1],
[5002, 4902, 1],
[5003, 4903, 1],
[5004, 4904, 1],
[5005, 4905, 0],
[5006, 4906, 0],
[5007, 4907, 1],
[5008, 4908, 1],

#This function is called every loop to check which bond has broken
def BreakingBonds():
 CurrentBonds = 0
  for i in O.interactions:
 if Bonds0 > CurrentBonds:
  global Bonds0
  Bonds0 = Bonds0 - 1
        m = 0
        for row in Connectivity:
                if (Connectivity[m][2] == 1):
                        if (O.interactions[Connectivity[m][1],Connectivity[m][0]].phys.isBroken == True):
                             Connectivity[m][2] = 0
                m = m + 1