Cold Gravitational Collapse
The code can be found on Github →HERE←
The following is an N-body simulation that models Cold Gravitational Collapse and was my final project for Intro Computational Physics. These types of simulations are used to solve the dynamics of a system of particles that interact with one another through interparticle forces such as gravity of Coulomb forces. The provided implementation optimized for run time on Super Computers (barring the computationally heavy visualization steps), like those used at the Pittsburgh Supercomputing Center.
For this project, the particle-mesh method was used, which calculates the net force on a given particle by mapping particles onto a mesh. From this mesh we can use Fast Fourier Transforms to solve Poisson’s equations for gravity. This density mesh/field/grid is constructed by assigning particles to a cloud-in-cell (CIC) scheme in 3D and is what we use for mass assignment.
Poisson’s equation gives us the potential in Fourier space. We can obtain this potential in cartesian by doing a forward FFT on our density field, multiplying the density fields by the gravitational kernel, and taking the inverse FFT of this result.
Finally, we can obtain and apply forces to our particles by finite differencing our potential field and interpolating acceleration. We interpolate the acceleration for each particle using the CIC scheme, similar to our density field. Not doing so allows for fictitious self-forces!