Change interaction during two spheres during the simulation process

Asked by Katja

Hi All,

I have a problem during discrete element modeling with YADE.
I want to change the interaction of two spheres during the simulation process through the following functions. I'm using a cohesive, frictional contact model (Luding Model). After my two particles are in contact with a specific overlap I want them to fall to the bottom of the box.

Here is the code:

#!/usr/bin/env python
#encoding: ascii

# Testing of the Deformation Enginge with Luding Contact Law
# Modified Oedometric Test

from yade import qt, utils, plot, timing
from yade import pack

o = Omega()

# Definition of the physical Parameter
fr = 0.3
rho = 0.002
Diameter = 4.5e-2
r1 = Diameter
r2 = Diameter

k1 = 1000
kp = 100*k1
kc = k1 * 1
ks = k1 * 0.1

DeltaPMax = Diameter/1.5
Chi1 = 1.0
tc = 0.0001
o.dt = 0.0001*tc

particleMass = 4.0/3.0*math.pi*r1*r1*r1*rho

Vi1 = math.sqrt(k1/particleMass)*DeltaPMax*Chi1
PhiF1 = DeltaPMax*(kp-k1)*(r1+r2)/(kp*2*r1*r2)

#Add material
mat1 = O.materials.append(LudingMat(frictionAngle=fr, density=rho, k1=k1, kp=kp, ks=ks, kc=kc, PhiF=PhiF1, G0 = 0.0))

# Add spheres
id1 = O.bodies.append(sphere(center=[0,0,0],radius=r1,material=mat1,fixed=True))
id2 = O.bodies.append(sphere(center=[0,0,2*r1],radius=r2,material=mat1,fixed=False))

# Import box's geometry
O.bodies.append(geom.facetBox(center=(0,0,0), extents=(2.25e-1,2.25e-1,2.25e-1), wallMask=31, material=mat1))

#Add engine
O.engines = [
  ForceResetter(),
  InsertionSortCollider([Bo1_Sphere_Aabb(),Bo1_Wall_Aabb(),Bo1_Facet_Aabb()]),
  InteractionLoop(
    [Ig2_Sphere_Sphere_ScGeom(), Ig2_Facet_Sphere_ScGeom(), Ig2_Wall_Sphere_ScGeom()],
    [Ip2_LudingMat_LudingMat_LudingPhys()],
    [Law2_ScGeom_LudingPhys_Basic()]
  ),
  NewtonIntegrator(damping=0.1, gravity=[0, 0, -9.81]),
  PyRunner(command='ChangePosition()', iterPeriod=1000, dead=False,label='checker'),
]

#Function Change Position
def ChangePosition():
 pairs = [(i.id1,i.id2) for i in O.interactions]
        O.interactions.clear()
        for id1,id2 in pairs: utils.createInteraction(id1,id2)

# spheres get closer:
O.bodies[id2].state.vel=Vector3(0,0,-Vi1)

qt.View()

Thanks for every help!!!!

Question information

Language:
English Edit question
Status:
Answered
For:
Yade Edit question
Assignee:
No assignee Edit question
Last query:
Last reply:
Revision history for this message
Katja (kadebro) said :
#1

If I change my interaction depending on K1:

#Function Change Position
def ChangePosition():
 pairs = [(i.id1,i.id2) for i in O.interactions]
 for i in range(0,2,1):
  k1n = O.bodies[i].material.k1 * 0.9
        O.bodies[i].mat = LudingMat(frictionAngle=fr, density=rho, k1=k1, kp=kp, ks=ks, kc=kc, PhiF=PhiF1, G0 = 0.0)
        if k1n <= 800:
          checker.dead = True

    O.interactions.clear()
    for id1,id2 in pairs: utils.createInteraction(id1,id2)

then I get the following error:

O.interactions.clear()
                                     ^
IndentationError: unindent does not match any outer indentation level

I appreciate you help, guys!!

Revision history for this message
Bruno Chareyre (bruno-chareyre) said :
#2

>IndentationError: unindent does not match any outer indentation level

This is unrelated to yade. Check python indentation rules.
Didn't check your code in details sorry, but you may find the problem.
Regards
Bruno

Revision history for this message
Katja (kadebro) said :
#3

Thanks Bruno for you advice!!

Do you may have an other idea how I can command my spheres to fall down to the bottom of the box, after they reached a certain overlap??

I really appreciate your help!! :)

Warm regards
Sophie

Revision history for this message
Bruno Chareyre (bruno-chareyre) said :
#4

I don't understand the question. Please close this thread by marking the question "answered" if the problem is solved.
You can open another thread if you have other questions.
Regards
Bruno

Can you help with this problem?

Provide an answer of your own, or ask Katja for more information if necessary.

To post a message you must log in.