Skip to content

REBOUND Hard-Sphere Fails for Long Contacts Under Gravitation #865

@ErickWhiteDev

Description

@ErickWhiteDev

Environment
Which version of REBOUND are you using and on what operating system?

  • REBOUND Version: 4.4.10
  • API interface: Python
  • Operating System (including version): Linux 24.04, running in WSL 2 on Windows 10

Describe the bug
The default REBOUND hard-sphere implementation, while effective for brief collisions, breaks down under periods of extended contact. This can be seen in, e.g., integrations of two rigid bodies resting against each other; assuming a coefficient of restitution e < 1, after the relative velocity between the spheres drops low enough, rather than resting against each other (as would be expected for rigid bodies), the two begin to sink into each other.

To Reproduce

import rebound

def coefficient_of_restitution(r, v):
    return 0.5

sim = rebound.Simulation()
sim.G = 1.0
sim.collision = "direct"
sim.collision_resolve = "hardsphere"
sim.coefficient_of_restitution = coefficient_of_restitution

sim.start_server(port=1234)

sim.add(m=1, r=2, x=10)
sim.add(m=1, r=2, x=-10)

sim.usleep = 16667

sim.move_to_com()

sim.integrate(float('inf'))

sim = None

This code snippet shows an example of the sinking behavior in a simple two-particle case with e = 0.5.

Additional context
@dangcpham and I discussed this issue in a meeting today; my current method of circumventing this involves reverse-time integration upon detection of a collision, followed by a bisection to determine the actual time of collision. This conserves energy very well (typically to within around 1E-13 relative error), but is computationally expensive.

Name/Affiliation
Erick White, Celestial and Spaceflight Mechanics Laboratory, Colorado Center for Astrodynamics Research, University of Colorado Boulder

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions