A star overflows its Roche lobe and feeds a white dwarf's disk until it ignites a nova.
In the frame that co-rotates with the binary, the Roche potential is sampled on a grid and contoured with marching squares, and the figure eight through the inner Lagrange point L1 marks the two Roche lobes. The donor fills its lobe exactly: its height above each pixel comes from solving the 3D Roche surface, so the teardrop gets limb darkening from the surface normal and gravity darkening from the local gravity, dimmest at the neck. Gas leaves L1 nearly at rest and falls under both stars plus the centrifugal and Coriolis forces (a Boris-style step keeps orbits closed), curving into a stream that hits the disk rim, where its lost kinetic energy becomes a hot spot. The disk glows as a blackbody that is white hot at the center, its turbulence carried around at the Keplerian rate with a two-phase flow map and brightened by two tidal spiral arms, and hydrogen piling up on the white dwarf ignites a nova that blows out the inner disk and throws off a clumpy shell, shown in slow motion.
Try it. Drag sideways (or use the left and right arrows) to change the mass ratio and watch the lobes, Lagrange points and stream reshape. Click the white dwarf or press N to ignite a nova early. C hides the equipotentials and R resets.
Paste this into Claude Code, Codex or any coding agent to get a simple version running, then take it wherever you like.
Build a binary star where one star spills gas onto a white dwarf, using JavaScript and the HTML canvas element. Put everything in a single index.html file with no libraries or build step, so I can open it directly in a browser.
Start simple:
- Work in the frame that rotates with the binary. Use separation 1, total GM 1 and angular speed 1. With mass ratio q = M_donor / M_dwarf, put the donor at x = -1 / (1 + q) and the white dwarf at x = q / (1 + q).
- The Roche potential is Phi = -mu_d / r_d - mu_w / r_w - (x^2 + y^2) / 2. Sample it on a coarse grid and draw contour lines with marching squares.
- Find the inner Lagrange point L1 on the x axis by bisection (where the x derivative of Phi is zero between the stars), and draw the contour through it: that figure eight is the pair of Roche lobes. Fill the donor's lobe with a glowing orange star.
- Release gas particles from L1 almost at rest and move them with gravity from both stars, the centrifugal force (x, y) and the Coriolis force (2 vy, -2 vx). Watch the stream curve around the white dwarf.
Once that works, make it beautiful:
- When a particle comes close enough to the white dwarf, nudge its velocity toward a circular orbit with a slow inward drift, so a disk builds up. Color particles by temperature, hotter toward the center.
- Heat the gas by the velocity change you remove, so a hot spot appears where the stream hits the disk.
- Let a horizontal drag change q and recompute the contours, the lobes and L1.
Explain the key ideas in short code comments. When you're done, tell me how to open it and suggest three directions I could take it next, such as shading the donor as a true 3D Roche surface with limb and gravity darkening, a nova outburst when enough hydrogen piles up, or marking all five Lagrange points.