I am testing DEME mesh-wall contact with pyDEME.
I created two single-sphere cases intended to differ only in the wall representation:
Analytic box:
InstructBoxDomainDimension(...) +
InstructBoxDomainBoundingBC("all", wall_material)
Fixed triangle mesh box:
AddWavefrontMeshObject(...) using a closed, manifold, inward-facing OBJ
with the same 50 x 50 x 50 mm internal dimensions.
Both cases use exactly the same particle, material-pair, solver, and initial
conditions:
The predicted first-impact speed is about 0.610557 m/s. Before impact, both
cases match exactly:
| Time | Analytic box | Fixed mesh box |
| 0.06 s | y = 2.34405 mm, speed = 0.588672 m/s | y = 2.34405 mm, speed = 0.588672 m/s |
However, after the first floor collision they differ substantially:
| Time | Analytic box | Fixed mesh box |
| 0.08 s | y = 5.00014 mm, speed = 0.140174 m/s | y = 10.70100 mm, speed = 0.460826 m/s |
The analytic case then settles normally. The fixed triangle-mesh case has a
much stronger rebound. With a larger 5e-6 s timestep, repeated mesh impacts
eventually increase velocity until the solver aborts at the 20 m/s velocity
limit. Reducing to 1e-6 s prevents the immediate instability but the rebound
difference remains.
I think this is an interesting observation, and the cause is multifaceted.
The divergence in DEME3 appears to be caused by merging sphere–triangle contacts across large angles on the mesh surface. Because the box has inward-facing normals, its corners are effectively highly concave regions. When a sphere hits a corner, contacting two or three mutually perpendicular walls, the solver attempts to combine the effects of those facets. This can produce a nonphysical effective contact point and destabilize the simulation.
This also explains why your script works in DEME2: DEME2 treats each triangle as an independent patch and does not merge the effects of adjacent facets.
To fix this in DEME3, call:
mesh.SplitIntoConvexPatches(45.0)after loading each mesh. This separates triangles across surface angles greater than 45°, preventing contacts from being merged across sharp corners. You can think of it as dividing the mesh into smaller, better-behaved contact patches. This should resolve the problem.
Alternatively, call:
solver.SetDEME2MeshBehavior()before loading any meshes. This restores the DEME2 behavior of treating every triangle as an individual patch. However, you might as well use DEME2 if you do this.
Both fixes require updating DEME3 to version 3.0.8. We are also investigating whether there is a more elegant, automatic and general solution for contacts in highly concave regions.
As a side note, I noticed that your script changes gravity after initialization. In older versions of DEME, including DEME2 and DEME3 3.0.7 or earlier, changing gravity alone does not immediately update the initialized workers. You must call:
solver.UpdateSimParams()after each change for it to take effect. Starting with DEME3 3.0.8, gravitational-acceleration changes are propagated immediately and take effect on the next simulation step.