Particle-Mesh Self-Gravitating 2D Disk
What you are seeing: a flat rotating disc of 1500 self-gravitating particles. The gravity force is computed by "particle-mesh": deposit the particle masses onto a 32 x 32 grid, solve Poisson's equation by FFT, interpolate the gradient of the potential back to each particle, and step forward.
Initial state: an exponential surface-density disc on a circular orbit. Over time, gravitational instabilities seed spiral arms and asymmetries; the disc heats up and the spiral structure dissolves. This is the simplest "galaxy formation in a box" toy. The PM scheme is what large astrophysical N-body codes (e.g. GADGET-4) use for the long-range force.
disc R1.00
speed1
WHAT TO TRY
- Let the disc evolve: gravity computed by depositing mass on a grid, solving Poisson by FFT and interpolating the force back lets 1500 particles clump and spiral. Particles are coloured by orbital speed, fast near the centre.
- Change the disc radius R: a more compact disc orbits faster and clusters sooner, since the dynamical time scales with the enclosed density.
- Watch the angular momentum L_z in the readout: the particle-mesh scheme conserves it well as the disc rearranges, the check that the FFT Poisson solve and the leapfrog are behaving.