Contact with AllowBiggerThanPeriod

Asked by Giulia Macaro

Hello,
I've noticed a weird behaviour that I cannot explain. Below there is a simple script reproducing the problem.

I have two spheres in a periodic cell. One sphere (blue in my script) is bigger than the period, so I am using the condition AllowBiggerThanPeriod=True. A vertical force is applied on the big blue sphere, which then pushes the other (red) one downwards.
The problem comes when the width of the cell is exactly the same as the diameter of the big blue sphere, or slightly smaller. In these cases I have no interaction between the two sphere: one spheres goes through the other, and then the big sphere reaches the end of the cell, is remapped on the other side, and only at the second time finally hits the other ball.
And this only happens when the width of the cell is between 0.6 and 1 time the diameter of the sphere, and when I generated the big blue sphere first and the small red sphere after.
I am aware that it is a really specific case, but still I do not understand why it happens.. am I missing something? And why does the order in which I'm generating the particles affect the test?

Thank you very much
Giulia

#!/usr/bin/python
# -*- coding: utf-8 -*-

DbigSphere = 1.
radius_bigSphere= DbigSphere/2
radius_sph = DbigSphere/10

# Periodic cell
#cell0 = DbigSphere*1.000000000000001 # ok - Anything bigger than that works fine
#cell0 = DbigSphere*0.605 # ok - Anything smaller than that works fine
cell0 = DbigSphere*1 # does NOT work
cell1 = DbigSphere*3.
cell2 = DbigSphere*3
O.periodic = True
O.cell.setBox(Vector3(cell0,cell1,cell2))

# Big blue sphere
center_bigSphere = Vector3(cell0/2.,cell1/2.,cell2*0.7)
bigSphere = utils.sphere(center=center_bigSphere, radius=radius_bigSphere, color=(0,0,1))

# Red small sphere
center_sph = Vector3(center_bigSphere[0], center_bigSphere[1]+1./5.*DbigSphere, center_bigSphere[2]-DbigSphere/2.-radius_sph)
sphere = utils.sphere(center=center_sph, radius=radius_sph, color=(1,0,0))

#O.bodies.append((sphere,bigSphere)) # ok
O.bodies.append((bigSphere,sphere)) # does NOT work

O.engines=[
 ForceResetter(),
 InsertionSortCollider ([Bo1_Sphere_Aabb()], allowBiggerThanPeriod=True),
 InteractionLoop ([Ig2_Sphere_Sphere_ScGeom()],[Ip2_FrictMat_FrictMat_MindlinPhys(),],[Law2_ScGeom_MindlinPhys_Mindlin()]),
 ForceEngine (force=(0,0,-100),ids=[bigSphere.id]),
 NewtonIntegrator (damping=0.5),
 PyRunner (command='recordFirstInteraction()',iterPeriod=1),
]

flagRFI = 0
def recordFirstInteraction():
 global flagRFI,iterFirst
 try:
  i=O.interactions[bigSphere.id,sphere.id]
  print'i.isReal ?',i.isReal,'\tStep',O.iter
  if i.isReal:
   if flagRFI==0:
    iterFirst=O.iter; print'iter first interaction\tStep',O.iter,' tOverlap',O.interactions[bigSphere.id,sphere.id].geom.penetrationDepth
    flagRFI=1
    O.pause()
 except StandardError:
  i=0

O.dt=0.2*utils.PWaveTimeStep()

Question information

Language:
English Edit question
Status:
Solved
For:
Yade Edit question
Assignee:
No assignee Edit question
Solved by:
Giulia Macaro
Solved:
Last query:
Last reply:
Revision history for this message
Bruno Chareyre (bruno-chareyre) said :
#1

The problem is apparently linked to fact that the bounding boxes are exactly touching each other in the initial state (b1.zmax = b2.zmin).
Moving the small sphere a bit further solves the problem, like this for instance:

center_sph = Vector3(center_bigSphere[0], center_bigSphere[1]+1./5.*DbigSphere, center_bigSphere[2]-DbigSphere-radius_sph)

closer works to:
center_sph = Vector3(center_bigSphere[0], center_bigSphere[1]+1./5.*DbigSphere, center_bigSphere[2]-DbigSphere/2.-radius_sph*1.01)

Remapping on the other side also fix the problem as it is like starting with fresh (not touching) bounding boxes.

Why it happens only for a special size of the period is not clear, and the fact that it is the size of the period along x which changes the behaviour is really weird (since the boxes are touching along z)...

It is bug clearly, I opened a report. Thanks for script.
It may be only a ">" to be replaced by a ">=" somewhere...

As long as it is not fixed, I guess you have to avoid bodies whose size is exactly the size of the period if their bounding boxes are exactly touching another box at step 0 (you were very unlucky to hit this situation...).

Revision history for this message
Bruno Chareyre (bruno-chareyre) said :
#2
Revision history for this message
Giulia Macaro (giulia-macaro) said :
#3

Not only it happens for a specific size of the period, but also for a specific order in which the spheres are appended in the simulation:
O.bodies.append((sphere,bigSphere)) works fine, but O.bodies.append((bigSphere,sphere)) does not work.

Thanks for confirming that it is a bug, at least I know that I am not doing anything wrong. I'll try to stay far from these very specific conditions.

Giulia (not Julia!)

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

Thanks for additional remark.
Better post further info in the bug report if you have some. It can help
the debugging.

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

Hi Giulia,

There are some news to this problem, you may try to see what happens after some changes in the code, see https://bugs.launchpad.net/yade/+bug/1112763