Non-reproducible Polyhedra contact force
Considering a Polyhedra description of two fixed contacting spheres (see image below), the measured contact force (even its orientation) is not reproducible.
Illustration
Script (also attached as poly4.py )
from yade import polyhedra_utils
toZplus = toZminus = orthZ = 0 # counter initialization
for i in range(4):
print('Run',i+1,'/ 4, please wait a couple of seconds')
O.reset()
O.materials.append(PolyhedraMat())
for z in [0,1.7]: O.bodies.append(polyhedra_utils.polyhedralBall(radius = 1,N = 200,material = O.materials[0],center = (0,0,z)))
for b in O.bodies: b.dynamic = False
O.engines=[ForceResetter()
,InsertionSortCollider([Bo1_Polyhedra_Aabb()],verletDist=0)
,InteractionLoop(
[Ig2_Polyhedra_Polyhedra_PolyhedraGeom()],
[Ip2_PolyhedraMat_PolyhedraMat_PolyhedraPhys()],
[Law2_PolyhedraGeom_PolyhedraPhys_Volumetric()]
)
,NewtonIntegrator()
]
O.step()
fz = O.forces.f(1)[2] # on top body
if fz > 0: toZplus+=1
elif fz < 0: toZminus+=1
elif fz == 0: orthZ +=1
print('\nAfter 4 runs, we detected on top body:\n-',toZplus,'times an upwards force to z+ (should be 4 times)\n-',toZminus,'times a downwards force to z- (should be 0)\n-',orthZ,'times a horizontal force (should be 0)')
Possible output with yadedaily and cgal 5.0.2 (not reproducible itself, please consider to re-run if you get the expected output)
Welcome to Yade 20210905-5894
02eb5b41focal1[.. Note an unknown warning ]
After 4 runs, we detected on top body:
- 3 times an upwards force to z+ (should be 4 times)
- 1 times a downwards force to z- (should be 0)
- 0 times a horizontal force (should be 0)
See #242
Edit: mentioning CGAL version
Edited by Jérôme Duriez