Loading the engineShared by all simulations, so the next one opens instantly.
The physics

An accretion disk forms when gas falls toward a star or black hole with too much angular momentum to drop straight in. The gas settles into a flat disk of nearly circular orbits, and it moves inward only as fast as friction between neighboring rings, which orbit at different speeds, carries its angular momentum outward. Nikolai Shakura and Rashid Sunyaev described this in 1973 by folding the unknown turbulent friction into a single viscosity parameter α. Disks of this kind power X-ray binaries and quasars.

This simulation is a much simpler particle model: 800 independent test particles in the field of a central mass, with a drag along the direction of motion that removes angular momentum at the rate a viscous disk loses it.

What you see

The particles start in a ring between 289 and 340 pixels from the center of an 800 pixel world, at random angles, with speeds within 3 percent of the circular orbital speed. Each particle’s color depends on its distance from the center, from warm yellow-white near the middle to dim blue-purple at the rim, and the canvas fades every frame, so moving particles leave short streaks. The glow in the middle marks the central mass, which is not a particle itself. Arrows show its gravitational field; switch them off with Force field.

Inner particles orbit faster than outer ones (Ω∝r−3/2), so the ring shears as it turns. At the default mass, one orbit at the rim takes 5,000 to 6,000 frames at normal speed, about a minute and a half on a 60 Hz display. While it turns, the ring drifts inward, slowly at first and faster as it shrinks. At the default viscosity its inner edge reaches the center after about 5,800 frames and its outer edge after about 8,000. Each particle that arrives is reborn at the rim, so after two minutes the ring has turned into a disk fed at its edge, with matter flowing steadily through it to the center.

Governing equation

Each particle feels the central mass and an azimuthal drag,

𝐫¨=−GMr3𝐫−3ν4r2vϕ𝝓ˆ,

integrated with the semi-implicit Euler method (velocity first, then position), four steps of 0.004 per frame. A particle that comes within 18 px of the center or moves beyond 442 px is put back at the rim with a new random angle and a nearly circular speed.

The drag is the torque of viscosity. It changes a particle’s specific angular momentum ℓ=rvϕ at the rate ℓ˙=−3ν4r2ℓ. On a nearly circular orbit ℓ=GMr, so losing angular momentum means moving inward, at the radial speed of a disk with kinematic viscosity ν:

drdt=−3ν2r,r(t)2=r02−3νt.

A particle starting at r0 reaches the center after t=r02/3ν, the viscous time of the disk, independent of the central mass. In a real disk the torque comes from friction between neighboring rings and passes the angular momentum outward to the gas there; here it simply disappears, which is why the particles can stay independent. Once the flow is steady, matter crosses every radius at the same rate M˙, and the surface density follows as Σ=M˙/3πν, the value Shakura and Sunyaev’s steady disk has far from its inner edge.

Presets

Standard disk: GM=180,000 and ν=300.

Massive BH (fast orbits): GM=400,000, so orbits run 400/180≈1.5 times faster. The ring still reaches the center at the same time, since the drift speed 3ν/2r does not depend on the mass.

High viscosity (fast infall): ν=1200. The rim reaches the center after about 2,000 frames, half a minute.

Low viscosity (slow infall): ν=60. The ring needs about 40,000 frames, eleven minutes, to reach the center.

Parameters

Central mass: the product GM, 40,000 to 400,000 (default 180,000). It acts immediately, and particles still moving at the old circular speed swing onto eccentric orbits.

Viscosity ν: the kinematic viscosity in px² per time unit, 0 to 2000 (default 300), also applied immediately. At 0 the particles keep their angular momentum and never fall in.

Force field and Equipotential lines draw the field of the central mass.