source: proiecte/NBody/Tree codes/README.txt @ 170

Last change on this file since 170 was 170, checked in by (none), 14 years ago
File size: 3.6 KB
Line 
1                                                                        Tree code - README
2
31. Agorithm description
4
5        The tree code approach provides a fast general integrator for collisionless systems. The idea a tree code is based on is grouping bodies that have similar positions into groups of bodies that have similar interaction lists.  The main steps of the algorithm are building the tree and computing the forces.
6        When building the tree, three main data structures were used: node, body and cell. A cell represents a structure that contains one or more bodies. It's actually a group of bodies. The "body" structure represents the particles that can be found in the system at a certain time. The "node" structure contains information commun to bodies and cells. The tree is constructed from the root by splitting the simulated volume into rectangular cubes. The tree structure is therefore called octal-tree or simply oct-tree. The division is accomplished by splitting each of the Cartesian dimension to a half. This repeatedly continues until the cube contains more than one body. If there is only one body in the cube left, it is stored as a leaf in the tree structure. When the cube is empty, it is ignored. The tree is composed of a hierarchical arrangement of leaves, nodes and the root. Using our data structures the bodies are the leaves of the tree and the cells are internal branches.
7        Forces on bodies are computed during a single recursive scan of the entire tree. The forces calculated are the gravitational force and the potential energy. Optionaly the Kynetic energy and the initial and total energy of the system can be calculated in order to check that the results of the program are correct.
8
92. Run and compile
10
11Compilation of the program can be made using the makefile in the archive issuing the console command:
12        make treecode
13
14The running of the program can be done with or without parameters. The program computes the initial conditions using the Plummer model if no initial paramateres are set in the command line
15Example of running command with parameters
16        treecode in=input.data out=output.data dtime=0.001 tstop=10 dtout=1.0 nbody=1000
17The parameters used in the line above are:
18                in              Input file with the initial conditions
19                out             Output file
20                dtime   Integration time step
21                tstop   Time to stop the integration
22                dtout   Data output timestep
23                nbody   Total number of bodies during the simulation           
24
25For finding out the time necessary for the program to run we can use:
26        time ~p treecode in=input.data out=output.data dtime=0.001 tstop=10 dtout=1.0 nbody=1000
27
28
293. Input file example
30
31N
32t
33m1 r1_x r1_y r1_z v1_x v1_y v1_z
34.....
35mN rN_x rN_y rN_z vN_x vN_y vN_z
36
37N is the total number of particles in the systems
38t represents the total time for the simulation
39mi - represents the mass of the particle
40ri_y, ri_x, ri_z - the position of the particle
41vi_y, vi_x, vi_z - the velocity of the particle
42Even though the total time of the simulation can be given through the command line parameters I chose this type of input file because it was the one used in the original Nbody simulation source code.
43
444. Output file example
45
46N
47dt
48m1 r1_x r1_y r1_z v1_x v1_y v1_z
49.....
50mN rN_x rN_y rN_z vN_x vN_y vN_z
51
52N is the total number of particles in the systems
53dt represents the time step in which the output was produced
54mi - represents the mass of the particle
55ri_y, ri_x, ri_z - the position of the particle
56vi_y, vi_x, vi_z - the velocity of the particle
57
58This is just one sequence of the output file.  The number of sequences included in an ouptut file is equal to tstop/dtout. We need dtout to be very small in comparison to tstop in order to have as many frames as possible to use in the OpenGL representation of the results.
Note: See TracBrowser for help on using the repository browser.