You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
- Velocity-Verlet N-body integrator (src/physics-engine.js) with vendored
three.js@0.160.0 (vendor/three/); zero CDN runtime dependency.
- KAM-stability presets (Real, phi, 2:1, 3:1, break) with physically-
justified parameters and inline cheat-sheet explainers in the HUD.
- Diagnostics with osculating Saturn:Jupiter period ratio (live Great
Inequality readout) computed from current positions via vis-viva.
- Mobile-first HUD: bottom-sheet layout below 768px, accessible sliders
(label/for associations), touch targets >=44px, prefers-reduced-motion
pauses simulation on load.
- Floating pause and screenshot controls (top-center) with SVG icons.
Screenshot saves a PNG of the current frame; spacebar toggles pause.
- CSS design-token system: styles/tokens.css holds all custom properties,
styles/main.css holds the rest. Retheming is a single-file edit.
- vitest unit tests for orbital-mechanics + physics-engine: 20 tests
covering Kepler placements, LRL eccentricity, energy/angular-momentum
conservation, COM invariance, capture detection. All passing.
- Documentation: README with file map and live-demo instructions;
PHYSICS.md with units, integrator choice, force derivations, KAM-preset
physical justifications, what's NOT modelled, and references
(Murray-Dermott, Wisdom-Holman, Laskar, KAM classics, Doyle Kepler-16b).
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Copy file name to clipboardExpand all lines: README.md
+37-21Lines changed: 37 additions & 21 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -11,22 +11,29 @@ Built with [three.js](https://threejs.org/), no build step required.
11
11
## What you can do
12
12
13
13
- Watch the real Solar System under Newtonian gravity at speeds from 1 to 1000 years per second.
14
-
- See Mercury's perihelion precession (the classical Newtonian part — about 5557″/century).
14
+
- See Mercury's perihelion precession from planetary perturbations — about 532″/century is the part an N-body integrator can in principle reproduce at long times (the 43″/century relativistic excess is not modelled; the demo doesn't measure the precession rate explicitly).
15
15
- Switch to the inertial frame and see the Sun wobble around the system's centre of mass (the basis of the radial-velocity exoplanet-detection method).
16
16
- Break stability through any of four mechanisms: planet masses, orbital eccentricities, inclinations, or gas drag.
17
17
- Apply KAM presets that demonstrate specific dynamical regimes: golden-ratio resonance protection, integer resonances (2:1, 3:1) at Kirkwood-gap positions, and full catastrophic collapse.
18
18
19
19
## Files
20
20
21
21
```
22
-
solar-system-split/
22
+
solar-system/
23
23
├── index.html page structure, importmap for three.js, UI panels
Unit tests for the pure-math modules and integration tests for energy / angular-momentum / centre-of-mass conservation.
48
+
49
+
```bash
50
+
npm install # one-time: installs vitest and three for testing
51
+
npm test
52
+
```
53
+
54
+
Runtime stays no-build — the npm dependencies are dev-only and live in `node_modules/` (gitignored). The page itself loads three.js from the vendored `vendor/three/`.
55
+
56
+
## Physics and numerical methods
57
+
58
+
See [PHYSICS.md](PHYSICS.md) for detailed documentation of units, the Velocity-Verlet integrator, force calculations (Newtonian gravity + linear gas drag), coordinate frames, derived quantities (Laplace–Runge–Lenz eccentricity, Kepler period), KAM preset rationale, asteroid-belt simplifications, and references.
59
+
38
60
## Run locally
39
61
40
62
ES modules require a local HTTP server — opening `index.html` directly via double-click will fail with CORS errors.
41
63
42
64
```bash
43
-
cd solar-system-split
65
+
cd solar-system
44
66
python -m http.server 8000
45
67
# then open http://localhost:8000 in browser
46
68
```
@@ -49,26 +71,16 @@ Or any other static server (Node `http-server`, VS Code Live Server extension, e
49
71
50
72
## Deploy to GitHub Pages
51
73
52
-
1. Create a new GitHub repository (e.g. `solar-system`).
53
-
2. Copy the contents of this folder into the repo root.
54
-
3. Commit and push:
55
-
56
-
```bash
57
-
git init
58
-
git add .
59
-
git commit -m "Initial commit: solar system simulation"
The simulation reproduces several real celestial-mechanical effects, in order of how visible they are:
80
92
81
-
1.**Perihelion precession of Mercury**(Newtonian only — ~5557″/century, classical part). Visible at speeds above 100 years/s as the orbit plane slowly turning.
93
+
1.**Perihelion precession of Mercury**— about 532″/century from gravitational perturbations by the other planets is what an N-body integrator is expected to reproduce at long times (the demo doesn't measure it explicitly). The famous additional 43″/century that Einstein explained via General Relativity is not modelled here; the often-quoted total of ~5600″/century includes the precession of the equinox itself, which is a choice-of-frame effect rather than an orbital one. Visible at speeds above 100 years/s as the orbit plane slowly turning.
82
94
2.**Sun wobble around the barycenter** in the inertial frame. The barycenter of the Sun-Jupiter pair lies 1.07 solar radii outside the Sun's surface in reality. Use the visual-scale slider to shrink the Sun and verify this geometrically.
83
95
3.**Precession of ascending nodes**, eccentricity oscillations (Laplace-Lagrange cycles, ~100 000-year period for Earth), inclination drift.
84
96
4.**Near-resonance Jupiter-Saturn**~5:2 ratio is a stable feature of the actual Solar System, reproduced naturally by N-body integration.
@@ -96,4 +108,8 @@ The simulation reproduces several real celestial-mechanical effects, in order of
0 commit comments