hw3 - CS 140 Assignment 3 Simulating the N-body Problem...

Info iconThis preview shows pages 1–2. Sign up to view the full content.

View Full Document Right Arrow Icon

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: CS 140 Assignment 3: Simulating the N-body Problem Assigned January 19, 2010 Due by 11:59 pm Monday, January 31 This assignment is to write an MPI program to simulate a large number of astronomical bodies (stars and planets) moving under the influence of gravity. You will write a parallel routine to generate the initial data in place, already distributed across the processors. For grading purposes, both correctness and performance (speed and scaling) will count. 1 Background Kepler and Newton showed that two bodies orbit around each other in elliptical paths, in the absence of any other influence. For systems with three or more bodies, however, there is in general no closed-form equation for the paths they follow. Therefore, cosmologists need to use simulation to understand such phenomena as galactic evolution. (It’s hard to set up a lab experiment with actual galaxies!) We start with n bodies whose masses, positions, and velocities we specify. The basic n-body computation is to compute the force that each body exerts on each other body ( n 2 forces in all); then compute how the sum of the forces on each body accelerates it (that is, changes its velocity); then compute, for each body, where it will move during a single “time step” at its new velocity. We repeat this computation over and over again, simulating one time step per iteration. The simulation isn’t perfect, because we pretend that the velocities don’t change in the middle of a time step; but we can make it more accurate by taking smaller and smaller time steps. Here are the mathematical details. Suppose the n bodies have masses m 1 , m 2 , . . . , m n (in kilograms); the initial position of the i-th body in 3-dimensional space is ( x i , y i , z i ) (in meters); and that the initial velocity vector of the i-th body is vectorv i = ( vx i , vy i , vz i ) (in meters/second). The force between bodies i and j comes from the gravitational law, f = Gm i m j /r 2 , where r is the distance between them (in meters) and...
View Full Document

This document was uploaded on 02/22/2011.

Page1 / 3

hw3 - CS 140 Assignment 3 Simulating the N-body Problem...

This preview shows document pages 1 - 2. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online