I I made an N-body simulation program

AI Thread Summary
A project focused on solving the 3-body gravity problem evolved into a comprehensive N-body simulator that incorporates both gravitational and electromagnetic interactions, utilizing special relativistic mechanics. The program allows for unique simulations, such as modeling a hydrogen atom alongside a microscopic black hole, demonstrating advanced numerical integration techniques. Users are encouraged to explore the simulation's capabilities, with feedback welcomed for further improvement. The discussion also highlights the complexity of N-body simulations and shares resources for additional learning. Overall, the project showcases innovative programming and physics integration.
Random Physics Fan
Messages
1
Reaction score
7
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 both electromagnetic and gravitational interactions. I also replaced Newtonian mechanics with special relativistic mechanics (as for the model of gravity, general relativity is too challenging for me, so I used an approximation under the weak field limit which was Lorentz-invariant).
You can do all sorts of weird simulation such as the following:

Object 1 (e-) and object 2 (p+) form a hydrogen atom under the classical Bohr's model, with n = 10; object 3 is a hypothetical microscopic blackhole with the mass of the Moon, placed 10 mm under the hydrogen atom.

Object 1:
mass: 9.11e-31 / charge: -1.60e-19
position: 5.29e-9,0,0 / velocity: 0,218500,0

Object 2:
mass: 1.67e-27 / charge: 1.60e-19
position: 0,0,0 / velocity: 0,0,0

Object 3:
mass: 7.35e22 / charge: 0
position: 0,0,-0.01 / velocity: 0,0,0

Duration of simulation: 1e-12 / number of steps: 1000
-> Use advanced option and turn on scientific notation (to show the position of the electron)

(Note: the Schwarzschild radius of the blackhole is about 0.11mm (<<10mm), so general relativistic effects like gravitational time dilation are insignificant.)

Please try out my little program and you comments are appreciated!
 
  • Like
Likes davyzhu, Bandersnatch, vanhees71 and 4 others
Physics news on Phys.org
Hi,

Congratulation. I did an N-body simulation (yours is N=3) some time ago. It is really not easy nor it is dead, in my eyes. Perhaps you are interested in the following material: N-Body

Have fun!
 
  • Like
Likes aaroman and vanhees71
Great work @Random Physics Fan and @Omega0

While I can't comment on the accuracy of your simulations, from a programming standpoint, I'm sure others can benefit from what you folks did.

As an aside, there are also some good simulations at the Open Source Physics website done in Java using the OSP library of simulation routines.

www.compadre.org/osp

And with that said, its a good time to close this thread.

Jedi
 
Consider an extremely long and perfectly calibrated scale. A car with a mass of 1000 kg is placed on it, and the scale registers this weight accurately. Now, suppose the car begins to move, reaching very high speeds. Neglecting air resistance and rolling friction, if the car attains, for example, a velocity of 500 km/h, will the scale still indicate a weight corresponding to 1000 kg, or will the measured value decrease as a result of the motion? In a second scenario, imagine a person with a...
Thread 'Gauss' law seems to imply instantaneous electric field propagation'
Imagine a charged sphere at the origin connected through an open switch to a vertical grounded wire. We wish to find an expression for the horizontal component of the electric field at a distance ##\mathbf{r}## from the sphere as it discharges. By using the Lorenz gauge condition: $$\nabla \cdot \mathbf{A} + \frac{1}{c^2}\frac{\partial \phi}{\partial t}=0\tag{1}$$ we find the following retarded solutions to the Maxwell equations If we assume that...
Dear all, in an encounter of an infamous claim by Gerlich and Tscheuschner that the Greenhouse effect is inconsistent with the 2nd law of thermodynamics I came to a simple thought experiment which I wanted to share with you to check my understanding and brush up my knowledge. The thought experiment I tried to calculate through is as follows. I have a sphere (1) with radius ##r##, acting like a black body at a temperature of exactly ##T_1 = 500 K##. With Stefan-Boltzmann you can calculate...
Back
Top