# What is N-body simulation: Definition and 24 Discussions

In physics and astronomy, an N-body simulation is a simulation of a dynamical system of particles, usually under the influence of physical forces, such as gravity (see n-body problem). N-body simulations are widely used tools in astrophysics, from investigating the dynamics of few-body systems like the Earth-Moon-Sun system to understanding the evolution of the large-scale structure of the universe. In physical cosmology, N-body simulations are used to study processes of non-linear structure formation such as galaxy filaments and galaxy halos from the influence of dark matter. Direct N-body simulations are used to study the dynamical evolution of star clusters.

View More On Wikipedia.org
1. ### I I made an N-body simulation program

My little project - 3body simulator started as a programming exercise, which I attempted to make a program that solves the famous 3-body gravity problem using numerical integration. Later I gained interest in the underlying physics and expanded the program to solve N-body problems involving...
2. ### Need help with N-body simulation

Many years ago, for my high school senior project, I wrote a solver for the N-body problem that is performance-optimized using the Barnes-Hut algorithm. (the optimization algorithm is not relevant to my question.) In one particular simulation, I simulated a spiral galaxy. The simulation is not...
3. ### I N-body simulation of high or low-mass dark matter particles

Do we notice any significant difference in distribution and dynamics of dark matter in galaxies when n-body simulations are done with high or low-mass dark matter particles?
4. ### Wrong solution order using Runge Kutta 4

Hi, I'm trying to simulate a 3-body problem with a star at the center of reference system and 2 body orbiting around it using Runge Kutta 4. The 2 bodies perturb each other orbits gravitationally, so my ode system is actually a coupled armonic oscillator and I evaluate the solution of both...
5. ### A N-body simulation with varying neutrino mass

I am trying to find a picture of the N-body simulations that shows the LSS. Particularly I am looking for different neutrino masses without the CDM. For instance pictures likes this But with more varying/different neutrino masses. I am looking for articles
6. ### A N-Body Simulation using symplectic integrators

Hi, I hope I am in the right section of the forum. I was trying to understand the following algorithm: https://benchmarksgame-team.pages.debian.net/benchmarksgame/program/nbody-python3-1.html and particulary this part: def advance(dt, n, bodies=SYSTEM, pairs=PAIRS): for i in range(n)...
7. ### How can I optimise my N-body Simulation code further?

Homework Statement I wrote a brute force O(N^2) N-body code in python and I am not happy with its performance despite the fact that I have cythonised the calculation heavy parts as well as implemented MPI. I am currently out of ideas for how to optimise it further, can I get some advice...
8. ### I N-body Simulations: Density vs Circular Profiles

N-body simulations of rotating galaxies involve density profile and circular profile. Would it be accurate to say that the essential difference between density profile and circular profile is that the former involves gravitational mass while the latter involves inertial mass?
9. ### A GADGET2 Simulations: Fixing N-GenIC Error

So this is a pretty specific technical question - but if anyone has experience running the N-body simulation GADGET2, I'm generating initial conditions using N-GenIC, and trying to turn on gas particles in the makefile gives the same error as described here...
10. ### N-body simulation - straight line orbits

Homework Statement The problem is your typical N-body simulation, implemented using Python and Numpy. The implementation specifically calls for using the Euler-Cromer method. For this particular case I used the Sun and the first 4 planets of the solar system. Essentially the problem is I'm...
11. ### B Just how Powerful is Computer Science + Astrophysics?

It seems that for a long time astronomy and cosmology have been based on observation and then speculation. Those two tasks are both very hard on their own, with the observation costing tons of money to be able to produce effective telescopes and observation methods. Speculation is even harder...
12. ### I How is it that the SPH cubic spline kernel in normalized?

Hi, (This is more of a math question but I thought Astronomy people would be more familiar with the equation and how it's used) So in Monaghan 1992 (http://adsabs.harvard.edu/abs/1992ARA&A..30..543M, bottom of pg 554) a cubic spline in three dimensions is defined. I tried to integrate it (using...
13. ### C/C++ Getting Started with C++ (for N-Body Simulations)

Hello all. I don't really know what to exactly ask from any of you other than how I should get started with C++ programming to hopefully create N-body simulations down the road. How to exactly start, I'm not entirely sure. For a little about what I know, I know python extensively. I use it...
14. ### Cosmology Book for someone new to N-Body Simulations

Hi, I'm interested in research on the formation of dark matter halos and was hoping that I might, in the future, run an N-Body simulation on the subject. However, I do not have any experience with N-Body simulations. I only know C, but I am learning Python. So, does anyone have a suggestion for...
15. ### Python Making a pretty n-body simulation

Hi all, I have recently created an nbody simulation in Vpython for a few thousand particles where each particle is about 4000 times the mass of our Sun. Vpython is doing exactly what I want it to do the only problem being the output is extremely low quality (black spheres on a white...
16. ### Simulating the Solar System with N-Body Simulation in Java

I have a made a fully functional n-body simulation for a project in high school, written in Java. Right now, to "simulate" the solar system, I am simply spawning the different bodies at their respective distance from the sun with an initial velocity calculated by v = sqrt(G*M/r), as shown in...
17. ### Help building an n-body simulation incorporating the speed of gravity

I would like some introductory level references for building an n-body gravity simulation. I work for the supercomputer challenge [ http://challenge.nm.org/ ] and I build the teaching models each year we use to train teachers in computer modeling and provide as an example model for the students...
18. ### Runge-Kutta for gravitational N-Body simulation - prediction of acceleration

Runge-Kutta for gravitational N-Body simulation - "prediction" of acceleration Hey! I'm Raph, as you can see this is my first post, so, thus I'll start saying that it's nice to be here ;). I've got the following question: I'm simulating a system of N gravitationally interacting objects...
19. ### Why is my N-Body Simulation in Matlab Showing Errors?

Hello all. I'm currently writing a program in Matlab that works out the positions of N bodies under the influence of gravity. The code is setup such that it only requires a mass and an initial position and velocity for each body. Any number of bodies can be entered but for testing purposes I am...
20. ### N-body simulation- objects accelerate *past* each other

Homework Statement I am making a standard N-body simulation for a computer science class and, for some reason, the objects that I am simulating accelerate past each other, and then engage in spring-like motion, getting closer and then farther apart, etc. Obviously incorrect. Homework...
21. ### N-Body simulation: MERCURY vs. Swift

I've been hearing that these (MERCURY and Swift codes) are standards for N-Body evolution simulations. Neither of them seem to be currently in development however. Does anyone know if these (or others) are indeed still commonly in use? If anyone has used either or both, could you say a few...
22. ### Solving N-Body Simulation Problems with Gravitational Equations

I'm having problems with an n-body simulator. I tried to use the gravitational equation for vectors, however that didn't exactly work, so I split up the forces into their respective X and Y components and used two separate gravitational equations. The problem is the entire body is exploding...
23. ### N-body simulation test with sun, earth and moon

Hi ! first, excuse my english, I'm just a poor french student... and we are so bad in languages here... anyway.. I'm trying to make a little program which could calculate the motion (and some other little things) of n bodies linked with gravitationnal interaction. (my final aim will be to...
24. ### What is the Optimal Size for a Cosmological N-Body Simulation Box?

Hi, Could some body please explain me how to identfy the size of simulation box in cosmological n-body simulation with the physical scales in the universe. For example if I am using 128 grid points along one direction in a Particle Mesh code and total number of particles are 128*128*1228. Now...