# GalaxSee

(Difference between revisions)
 Revision as of 19:54, 30 June 2009 (view source) (→Physics Assumptions)← Older edit Revision as of 14:07, 2 July 2009 (view source)m (→Classes)Newer edit → Line 28: Line 28: === World === === World === This is an object-oriented handle to an MPI_Comm.  It spawns processes and distributes the work load across them. This is an object-oriented handle to an MPI_Comm.  It spawns processes and distributes the work load across them. + + === Job === + World uses Job to distribute the workload, i.e. on which chunk of points each process should do calculations.  Job also performs the MPI calls to move the points array in between all of the processes. == Physics Assumptions == == Physics Assumptions ==

## Problem description

GalaxSee is a simulation of the n-body problem. A galaxy of stars (or point-masses) is generated with random positions and velocities, spun, and updated as the stars exert forces on each other.

## Parameters

GalaxSee is run with the following command line: mpirun -np NUMPROCS [-m M] [-t T] [-x] STARS

• NUMPROCS = the number of processes on which to run. If no additional arguments are specified, NUMPROCS must be 1.
• STARS = the number of stars in the galaxy, 512 by default.
• -m - the mass of each star (all stars have the same mass), 200 by default
• -t - the number of ticks or time steps to run, infinite by default
• -x - a flag that suppresses the graphical (X) display

## Classes

### Point

A single body. A point has position, velocity, and acceleration, all in <x,y,z> coordinates.

### Galaxy

The galaxy initializes the points with random positions and velocities, spins the points around the center, and thereafter makes updates to the points' positions, velocities, and accelerations based on their gravitational interactions with each other.

### RunManager

This creates two separate threads. It receives the following commands and executes them accordingly:

• start [NUMPROCS] [args]\n --- starts a galaxy running over NUMPROCS threads with args as arguments.
• show\n
• pause\n --- halts the galaxy's updates
• unpause\n --- resumes the galaxy's updates
• quit\n or exit\n

### World

This is an object-oriented handle to an MPI_Comm. It spawns processes and distributes the work load across them.

### Job

World uses Job to distribute the workload, i.e. on which chunk of points each process should do calculations. Job also performs the MPI calls to move the points array in between all of the processes.

## Physics Assumptions

• Gravitational Constant = 6.673 * 10^-11 m^3 / (kg * s^2)
• Mass of the sun = 1.99 * 10^30 kg
• Accelerations are calculated based on the formula found here, where gamma in our case is Gnorm = Gconst * mass(sun) / (3 kilo light years / (2 * seconds in 1 million years))
• There is a Shield Radius, which is the distance between two points under which no gravity takes effect. This is calculated as 5 * cube_root(Gnorm * mass) * cube_root(time_step^2)