We originally wanted to model star formation in a 3d environment, but due to the limitations of finding a poisson equation solver in 3d, we ended up modelling gravitating fluids in a 2d environment.

The code makes use of a 2D poisson equation solver to find the gravitational field from our density field. It also implements the ideal hydrodynamic equations to calculate the change in energy, density, and velocity while maintaining conservation laws. With more time and effort, the project can be extended to larger scales and can observe potentially interesting initial conditions. It can also be extended into 3D and be edited to make use of magnetohydrodynamics.

The visualization uses matplotlib to generate a frame for ever time step. The darker the color of each point, the higher the density is there.

Built With

Share this project:

Updates