Adding an interaction

Asked by Najm

Hi,

To delete an interaction between two bodies, I do the following:

O.interactions.erase(id1,id2)

How do I add an interactyion between id1 and id2?

Thanks!

Question information

Language:
English Edit question
Status:
Solved
For:
Yade Edit question
Assignee:
No assignee Edit question
Solved by:
Najm
Solved:
Last query:
Last reply:
Revision history for this message
Jan Stránský (honzik) said :
#1
Revision history for this message
Najm (mrhappy) said :
#2

Hey,

Thank you for your reply. I followed [1] but it does not work. Cna you check my code?

[1] https://yade-dem.org/doc/user.html#individual-interactions-on-demand

Thank you soo much for your help!

# MATERIAL PROPERTIES
intR=20 # allows near neighbour interaction (can be adjusted for every packing)
DENS=2500 # Density
YOUNG=1800
FRICT=7
ALPHA=0.1
TENS=1000000000000000
COH=1000000000000000000
iterMax = 1

O.materials.append(JCFpmMat(type=1,density=DENS,young=YOUNG,poisson=ALPHA,frictionAngle=radians(FRICT),tensileStrength=TENS,cohesion=COH,label='mat1'))

# PARTICLES
O.bodies.append([
  # 0
  sphere(center=(0,0,0),radius=0.5,fixed=True,material='mat1'),
  # 1
  sphere((0,1,0),radius=0.5,material='mat1')
])

nbSpheres = 2;

# BOUNDARY CONDITION
O.bodies[1].state.blockedDOFs = "xyzXYZ"
O.bodies[1].state.vel = (0,0.001,0)
O.bodies[1].state.angVel = (0,0,0)

# FUNCTIONAL COMPONENTS
# 1
def addPlotData1():
        plot.addData(t=O.time,DX1 = O.bodies[1].state.pos[0],DY1 = O.bodies[1].state.pos[1],DZ1 = O.bodies[1].state.pos[2], FX1 = O.forces.f(1)[0], FY1 = O.forces.f(1)[1], FZ1 = O.forces.f(1)[2])

# 2
def addPlotData2():
 plot.saveDataTxt('/home/nabid/Desktop/SCRIPTS/dataFile.txt',vars=('t','DX1','DY1','DZ1','FX1','FY1','FZ1'))

#PRINTING
from yade import plot
from pprint import pprint

i=createInteraction(0,1)
i.geom, i.phys

# SIMULATION LOOP
O.engines=[
  PyRunner(command='addPlotData1()',iterPeriod=1),
  PyRunner(command='addPlotData2()',iterPeriod=1),
     ForceResetter(),
      InsertionSortCollider([Bo1_Sphere_Aabb()]),
   InteractionLoop(
      [Ig2_Sphere_Sphere_ScGeom(),],
      [Ip2_FrictMat_FrictMat_FrictPhys()],
  [ ]
  ),
      GlobalStiffnessTimeStepper(active=1,timeStepUpdateInterval=10,timestepSafetyCoefficient=0.5, defaultDt=utils.PWaveTimeStep()),
  NewtonIntegrator(damping=0.1),
]

#TIME STEP
O.dt=0.5e-4*PWaveTimeStep()

#PLOTTING
plot.plots={'DY1':('FX1','FY1')}
plot.plot()

O.run(iterMax)
# SAVE SIMULATION

Revision history for this message
Najm (mrhappy) said :
#3

I figured it out.

Thanks!