Cosmic Gas Disc
crazyweeb2006
An interactive, GPU-accelerated protoplanetary disk sandbox where 100,000 dust tracers, gas drag and an adjustable planet are viewed through five wavelength-inspired modes.

What it does
The physics
A young star is surrounded by a disk of gas and dust. The gas is slightly pressure-supported, so it orbits a bit slower than Keplerian. Dust grains feel drag against that gas, which lets me tie grain size to behaviour through the Stokes number. Small grains follow the gas, and larger ones drift inward and settle toward the midplane, opposed by turbulence. A planet's gravity stirs the dust, and its Hill radius, Crida gap criterion and Kanagawa gap depth tell you whether it could open a gap. The disk is flared, with temperature falling as r^-0.43 and scale height growing as r^0.285.
What I built
A single-file Python and Taichi app. 100,000 dust tracers are integrated on the GPU with a kick–drag–drift–kick scheme. A CPU-side telemetry deck computes about 30 quantities live, and an interactive 3D view has camera bookmarks and click-to-inspect.
What it does
You fly around the disk and change the planet's mass, orbit, eccentricity and migration, or the drag, turbulence and Stokes scale, while the dust responds in real time. Five colour modes (ALMA, JWST, UV/Hα, thermal IR, CO Doppler) show the same disk at different wavelengths. It is a visual, exploratory model. The gas is analytic, and the colour modes are stylised, not radiative transfer.
What I had to figure out Stiff drag at 100k particles. Tightly coupled grains have stopping times far shorter than the timestep, so I used an exact exponential decay update instead of an explicit one. Realistic stopping times. They depend on local gas density, so I tied them to height above the midplane. Self-consistent disk structure. I matched the flaring exponent to the temperature law, since 0.285 = (1 − 0.43)/2. Stable dynamics near the star and planet. I used softened gravity and recycled particles that leave the annulus. Sensible sampling. I drew grain sizes and radii so the disk looks right, then had to check them against the intended distributions. Turning theory into visuals. I had to map a sub-Keplerian offset, Stokes numbers and gap criteria onto something you can see and click.