GPU- Galactic collisions with CUDA

 

This project focuses on using CUDA (from NVIDIA) for an n-body simulation of our MilkyWay galaxy and the Andromeda galaxy about 5 billion years from now.

The Data set for these galaxies were obtained from the following link.

http://bima.astro.umd.edu/nemo/archive/#dubinski

As can observed from the data set, both Andromeda and the Milkyway galaxies are split into 3 regions

a) Bulge
b) Disk
c) Halo 

The various ways approximations we could do to run the simulations by selectively using a few or all parts of the galaxies would determine the frame rate and accuracy achieved in this simulation.

Various scenarios/ optimizations and simulation videos associated with them could be found below.


Press key "1" to get to this collision in the application


49512 non halo from arun rakesh yoganandan on Vimeo.

The above video shows galactic collisions taking all 49512 particles into consideration (without the halo). The leakage from the core increases a bit but still falls within the acceptable level. The interactions are a little less robust in this case with one of the galaxies expanding and loosening out to mix with the other.


Press key "2" to get to this collision in the application


The above video shows galactic collisions taking 49512 particles into consideration including particles from the halo. The leakage from the galaxy increases even further in this case.

Press key "3" to get to this collision in the application


The above video shows galactic collisions taking just every 5th element into consideration (without the halo). The interaction is very fast and there is little leakage of particles from the core. The two galaxies collide initally and then swirl about each other and at the end join together to form the combined core.


User interactions:

The user can

  • Rotate: using mouse left button down and move
  • Pan: using mouse center button down and move
  • Zoom: either using the visual slider on the screen or using mouse right button down and move.
  • "1", "2", "3" keys for switching between modes
  • " [ ", " ] " keys to switch scenarios

Visual Enhancements:
The particles are colored based on their velocity values with R= Vx, G =Vy and B =Rz. This gives us an idea of which direction each part of the galaxy is moving towards.

inside randomizeBodies function

if (color)
{
int v = 0;
for(int i=0; i < numBodies; i++)
{

float3 vel_color = {vel[4*i], vel[4*i+1], vel[4*i+2]};

normalize(vel_color);

//Set color based on velocity values.....
color[4*i] = vel_color.x;
color[4*i+1] = vel_color.y;
color[4*i+2] = vel_color.z;
color[4*i+3] = 1.0f;

}
}

}

Performance analysis:

A few tests were performed to get an idea about the contribution of each factor to the performance of this simulation.


Effect of increasing the number of bodies was found to decrease the frame rate


Full load

Other interesting configurations/ scenarios

Apart from the videos shown above of regular collisions between the bodies, depending on the parameters provided, we could get a few other interesting interactions shown below.


Untitled from arun rakesh yoganandan on Vimeo.

Needles from arun rakesh yoganandan on Vimeo.

Untitled from arun rakesh yoganandan on Vimeo.

draw inwards from arun rakesh yoganandan on Vimeo.

bull configuration from arun rakesh yoganandan on Vimeo.

brush and go from arun rakesh yoganandan on Vimeo.







References:

1) MODELING GALAXY INTERACTIONS

http://www.kof.zcu.cz/st/dis/schwarzmeier/galaxy_interactions.html


2) FAST N-BODY SIMULATION WITH CUDA

http://developer.download.nvidia.com/compute/cuda/sdk/website/projects/nbody/doc/nbody_gems3_ch31.pdf