Skip to content

List close approaches to the Sun with the other close encounters - #102

Open
AstroEloy wants to merge 1 commit into
wmpg:masterfrom
AstroEloy:feature/rebound-sun-encounters
Open

AstroEloy wants to merge 1 commit into
wmpg:masterfrom
AstroEloy:feature/rebound-sun-encounters

Conversation

@AstroEloy

Copy link
Copy Markdown
Contributor

Summary

The Sun has no Hill radius, so REBOUND.py tracked its distance but never listed it as a close encounter, and it could not be hit either. This adds both, with a small change.

  • Close approaches. A perihelion passage closer than SUN_ENCOUNTER_AU = 0.1 AU goes into the same encounter list as the planets, in time order. The Sun gets a fixed distance threshold, not a fake Hill radius, so its entries have hill_radius_au and n_hill set to None. The terminal and report lines show the distance in solar radii instead of R_Hill, and the headers state both rules:
    Close encounters (< 3 Hill radii, Sun < 0.10 AU), in the order they happened:
    
  • Impacts. SUN_RADIUS_AU (695,700 km) is added to the default body_radii, so an orbit that dives into the Sun ends in an impact.
  • The WHFast warning counts Sun passages too, since WHFast degrades at small perihelia.
  • The JSON gets sun_encounter_au next to n_hill_threshold. Readers of "encounters" must allow n_hill to be None, and the example in REBOUND.md is updated for this.

Tests

  • Replaced the test asserting that the Sun is never an encounter with two new tests: a Sun passage at 0.05 AU is listed and one at 0.15 AU is not, and a perihelion inside the Sun is an impact.
  • 84 passed on rebound 5.1.1 / reboundx 5.1.0.
  • Mutation-checked: removing the Sun gate, the Sun radius, or the record builder's acceptance of the Sun each fails one of the new tests.
  • Ran the CLI on the example trajectory (forward, with a temporarily wider threshold) and checked the terminal, report file and JSON output.

Notes

  • The threshold is a module constant, like n_hill.
  • A stream with perihelion below 0.1 AU gets one Sun line per perihelion passage. The δ Aquariids (q ≈ 0.07 AU) would get about 20 over 100 years; this is estimated from the orbit, not run.

🤖 Generated with Claude Code

The Sun has no Hill sphere, so it was tracked for its distance but never
listed. It is now flagged by a fixed distance (SUN_ENCOUNTER_AU = 0.1 AU)
in the same encounter list, with hill_radius_au and n_hill set to None.
The Sun also gets its physical radius for impact detection.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant