ASTR 474 · Computational Astrophysics · Lecture 04

Lecture 04: N-Body Systems, Invariants, and Close Encounters

How can conservation diagnostics reveal a timestep that looks visually plausible?

14-week course · 3 credits · Week 4

Motivation

How can conservation diagnostics reveal a timestep that looks visually plausible?

Mutual gravity couples all particles, and close approaches shorten local dynamical timescales. WHFast is effective for hierarchical systems with a dominant primary; adaptive IAS15 or hybrid methods are more suitable when close encounters violate that structure.

Today’s result must be interpretable as a physical statement with declared data, algorithm, uncertainty, and a check that could fail.

Learning objectives

After this lecture, you can

Core language

Terms for This Lecture

N-body system

Definition: A set of mutually gravitating particles whose accelerations depend on every other particle.

Why it matters here: It helps answer How can conservation diagnostics reveal a timestep that looks visually plausible? within the numerical model described here.

Relationships: Connect it to Invariant, the governing expression \(\ddot{\mathbf r}_i=G\sum_{j\ne i}m_j\frac{\mathbf r_j-\mathbf r_i}{|\mathbf r_j-\mathbf r_i|^3}\), and the computed diagnostic developed later in the lecture.

Boundary or common confusion: Good invariant conservation is necessary but not sufficient: conserved errors can coexist with wrong initial conditions, wrong frames, or missing forces.

Physical and mathematical model

State what is being evolved

Mutual gravity couples all particles, and close approaches shorten local dynamical timescales. WHFast is effective for hierarchical systems with a dominant primary; adaptive IAS15 or hybrid methods are more suitable when close encounters violate that structure.

\[\ddot{\mathbf r}_i=G\sum_{j\ne i}m_j\frac{\mathbf r_j-\mathbf r_i}{|\mathbf r_j-\mathbf r_i|^3}\]

Define the state, coordinates, units, initial/boundary conditions, and domain before interpreting solver output.

Numerical method

Algorithm choice is a modeling decision

Use the Sun-Earth-Jupiter benchmark with measured mass parameters and declared idealized circular geometry; compare fixed steps over 12 years; monitor energy, angular momentum, and center-of-mass momentum; rerun a close-encounter case with an appropriate hybrid method.

  1. Write the model and its assumptions.
  2. Choose a solver and identify its stability, accuracy, and conservation properties.
  3. Record configuration, tolerances or timestep, and output sampling.
  4. Compare against an analytic limit, independent method, or controlled refinement.

Visual reasoning

Sun-Earth-Jupiter hierarchy and conserved quantities

Three-body hierarchy and invariant auditThe three-body teaching setup shows the central mass and two planets on idealized nested tracks, with distinct plotted conservation errors by timestep. EarthJupiter 12-year WHFast invariant audit64/yr128/yr256/yr Computed relative energy-error scale
The drawn orbits show the model hierarchy; the separate bars encode generated energy-error diagnostics for the synthetic geometry.

Computed example

One result, with a check

Across 12 years, the three-body WHFast relative energy error falls from 8.56e-12 at dt=5.707 d to 5.33e-13 at dt=1.427 d; angular-momentum and scaled momentum errors are tabulated separately.

Inputs and method are generated by src/astr474_computations.py; the machine-readable values are in data/generated/computed_results.json.

Good invariant conservation is necessary but not sufficient: conserved errors can coexist with wrong initial conditions, wrong frames, or missing forces.

Verification

What would falsify this result?

Do not report a smoother curve as proof of convergence.

Failure modes

Numerical agreement has a domain

Good invariant conservation is necessary but not sufficient: conserved errors can coexist with wrong initial conditions, wrong frames, or missing forces.

Solver error, discretization error, stochastic error, parameter uncertainty, and model discrepancy are different quantities. Diagnose and report them separately.

Active reasoning

Make a prediction before rerunning

How can conservation diagnostics reveal a timestep that looks visually plausible?

State a measurable outcome, a competing explanation, and the smallest computation that distinguishes them. Include an expected direction or scaling, then test it.

Workflow

From parameters to auditable output

Use the Sun-Earth-Jupiter benchmark with measured mass parameters and declared idealized circular geometry; compare fixed steps over 12 years; monitor energy, angular momentum, and center-of-mass momentum; rerun a close-encounter case with an appropriate hybrid method.

Record the exact command, package versions, data path, random seed if applicable, and output checksum. Keep raw inputs unchanged and generated files separate.

Transfer

Lab and problem-set connection

Lab 03 varies timestep in REBOUND and asks students to defend the integrator choice for an encounter.

Submit plots with labeled axes/units, a concise uncertainty argument, and enough code or intermediate values for a peer to reproduce the claim.

Synthesis

Three durable checks

  1. Does the implemented equation match the intended physical model?
  2. Does the numerical result converge under a controlled method change?
  3. Does the interpretation stay inside the validity and provenance limits?

Good invariant conservation is necessary but not sufficient: conserved errors can coexist with wrong initial conditions, wrong frames, or missing forces.

Sources

Technical references

Data and provenance details are recorded in reference-log.md. Last updated 2026-09-27.