Download presentation

Presentation is loading. Please wait.

Published byRyder Fosse Modified over 3 years ago

1
N B ODY G RAVITATIONAL P ROBLEM Seminar By Srinivasan Manoharan

2
P ROBLEM To compute the position of N bodies over a set of Iterations by using the forces that exists between the other bodies. A big mathematical conundrum I chose this problem because of the huge amount of computation involved in this problem. Mathematical Problem:- Consider n point masses in three dimensional space Assumption :- Force experienced between them is Newtonian. Then, if the initial positions in space and initial velocities are specified for every particle at some present instant t 0, determine the position of each particle at every future (or past) moment of time

3
P ROBLEM (C ONTD..) The All Pairs Approach is a brute force technique which evaluates the interactions between all the pairs of the N bodies. The problem with this approach is that the worst case computational complexity is O(N 2 ). The all pair approach is used for evaluating bodies that are interacting very closely. So the all pairs method is combined with a more efficient method,far field approximation of long range forces(Barnes Hut method). This far field method is only valid when the two bodies are well separated. The all pairs method requires substantial time to compute and an area where acceleration can be used.

4
C ALCULATION Force Between two bodies with a distance r is The total Force on the Body i is the summation of the all the forces other than i. i.e where j is 1 to N and not equal to j. Due to approximation, softening factor is included and Force = mass * Acceleration. Acceleration of the body,a i F ij =G*(m i* m j )/r ij 2 F i =∑F ij F i =G*m i *∑((m j r ij )/r ij 3 ) F i =G*m i *∑((m j r ij )/(r ij 2 +ε 2 ) 3/2 ). a i =G*∑((m j r ij )/(r ij 2 +ε 2 ) 3/2 ).

5
C ALCULATION ( CONTD..) With acceleration calculated, we can get the velocity v and the distance x for the body to move. We can calculate all F ij in a grid of size N * N. F11F12F13F14F15F16F1jF1n F21F22F23F24F25F26F2jF2n F31F32F33F34F35F36F3jF3n F41F42F43F44F45F46F4jF4n Fi1Fi2Fi3Fi4Fi5Fi6FijFin Fn1Fn2Fn3Fn4Fn5Fn6FnjFnn

6
S TRATEGY First we randomly position the bodies in the 3 dimensional space. Then we calculate the force exerted in all the axis using the formula. We calculate the acceleration by dividing the force by mass We calculate the velocity by multiplying the acceleration with delta time. Then finally we calculate the new position by multiplying the velocity with delta time.

7
S TRATEGY Each entry in the Grid can be calculated independently, therefore there is N 2 parallelism. But Since the memory is limited, we cannot use N 2 threads each computing the force in the grid. So we can calculate the forces in a row to be calculated in sequential order. And parallelize the columns as each thread can calculate the Force and acceleration of the body.

8
A NALYSIS We need to obtain the performance by By varying the number of bodies N interacting By Varying the number of iterations. By varying the number of threads per block. By varying the number of processors. The number of threads per block can also be varied,but the performance was better when I used p= 256 i.e 256 threads per block. Number of Blocks = Number of Bodies / Number of threads

9
T ABLE (N & N UMBER OF I TERATIONS )-S EQUENTIAL

10
T ABLE (N & N UMBER OF I TERATIONS )-P ARALLEL N - Number of BodiesTime for 2 Iteration in Milli sec16 Iteration128 iterations 20.7330.8372.818 40.7360.8743.204 80.7621.0393.456 160.7731.0543.531 320.781.0743.653 640.8011.0973.698 1280.8741.063.768 2560.8951.1683.897 5120.9811.2884.034 10241.1171.3214.245 20481.5272.6764.438 40962.453.5494.772 81923.2144.2926.351 163846.218.2311.774

11
P ERFORMANCE (T IME V S N)

12
P ERFORMANCE (T IME V S P ROCESSORS ) As the number of Nodes increases, the performance is better.

13
A NALYSIS & I NFERENCE The number of calculations involved is 34357641220 and computed in 11.4 milli seconds. Each calculation involves 14 operations. When the number of computation is less the processors are underutilized. But when the calculations increase the performance is far better than the sequential code. When the number of bodies is 32 the performance is better in parallel.i.e 126976 calculations.

14
QUESTIONS Thank You

Similar presentations

OK

17/5/16 Learning Objective: To develop an understanding of the relationship between work done, force and distance Learning Outcomes: Work out the relationship.

17/5/16 Learning Objective: To develop an understanding of the relationship between work done, force and distance Learning Outcomes: Work out the relationship.

© 2018 SlidePlayer.com Inc.

All rights reserved.

Ads by Google

Ppt on search and rescue Ppt on global warming and its effects Ppt on book review of fish tales Ppt on sound physics class 9 Ppt on way to success Ppt on seven segment display alphabet Ppt on chapter 3 atoms and molecules for kids Ppt on production management Convert word document to ppt online Ppt on solar distillation system