N-body random peak velocity of passing particles

In summary, the conversation discusses the challenges of simulating N-body systems, particularly when particles come too close to each other. The speakers suggest different approaches, such as adjusting the time step size and using interpolation, to improve the accuracy and usability of the simulation. However, they also acknowledge that there may not be a perfect solution and it ultimately depends on the goals of the simulation.
  • #1
CommanderLake
4
0
I've been experimenting with my own N-body simulation and I've found a seemingly unsolvable problem.
When 2 particles cross paths exactly the peak velocity varies according to how close they are at their closest point and they either fly off the screen or slow right down, I can add an offset to the gravitational force but that makes acceleration more linear.
Obviously the real world doesn't have an update rate so conventional physics probably won't help but I wonder if anyone here might be able to tell me how I might solve this?
 
Physics news on Phys.org
  • #2
Simulating these things is notoriously tricky because you keep accumulating errors over time.
One thing I can suggest, presuming you are developing this simulation yourself, is to switch from a global "grid clock" to a "particle clock" whose resolution you can adjust for each particle. If a particle starts experiencing a strong field you reduce the step size of its clock to stay accurate, and later bring it back to a more manageable (for the overall simulation) step size.

In terms of pure physics, of course there are classic solutions to the 2-body problem (Kepler etc), but those won't help you much with your simulation.
 
  • #3
Actually step size makes no difference because the particles have no size and its a matter of the ratio between how far apart they are before and after they pass, if they are closer after they pass they slow down and vice versa, thanks anyway for your input.
 
  • #4
CommanderLake said:
Actually step size makes no difference because the particles have no size...
The time step size makes a difference in accuracy, regardless of the particle size. The zero size assumption is a problem in the sense that it allows arbitrarily small distances and thus arbitrarily large forces. In reality the objects would collide instead.
 
  • Like
Likes rumborak
  • #5
Yeah, step size is a huge factor in these things, and often decide whether you have a reasonable simulation, or particles flying off the screen at ridiculous speed.
 
  • #6
imagine 1-dimensional 2-particle simulation. I am using units, where G=1. Masses of particles are ##m_1=1## and ##m_2=1##. In initial time ##x_1(0)=5.001##, ##v_1(0)=-1##, ##x_2(0)=-5## and ##v_2(0)=1##. therefore ##a_1(0)=-0.01## and ##a_2(0)=0.01##.
Maybe after reading this you understand better, what problem occurs in simulation when point-masses get too close.
  • ##t## ;##\ \ \ \ \ \ x_1\ \ \ \ \ \ ##;##\ \ \ \ \ \ v_1\ \ \ \ \ ##;## \ \ \ \ \ \ a_1 \ \ \ \ \ ##;## \ \ \ \ \ \ x_2 \ \ \ \ \ ## ;## \ \ \ \ \ \ v_2 \ \ \ \ \ ##;## \ \ \ \ \ \ a_2##
  • 0 ; 5.001000;-1.000000;-0.009998;-5.000000 ;1.000000;0.009998
  • 1 ; 4.001000;-1.009998;-0.015625;-4.000000 ;1.009998;0.015625
  • 2 ; 2.991002;-1.025623;-0.027954;-2.990002 ;1.025618;0,027954
  • 3 ; 1.965379;-1.053577;-0.064754;-1.964384 ;1.053572;0.064754
  • 4 ; 0.911802;-1.118331;-0.301030;-0.910812 ;1.118326;0.301031
  • 5 ;-0.206529;-1.419360;5.8332300;0.207514 ;1.419356;-5.833230
  • 6 ;-1.625889;4.4138700;0.0945140;1.626870;-4.413874;0.094514
  • 7 ;2.787981 ;4.5083840;-0.0321745;-2.787004;-4.31936;0.032174
 
  • #7
Here's a much more straightforward example:

One proton is at rest, and another proton is flying straight at it, at 1 m/s speed. And currently it's 1m away.
If you choose your time resolution to be 1 second, you find that at your next time step (i.e. 1 second later), the photon is *exactly* on top of the other one. Now you got infinite forces etc etc.

If on the other hand you choose 0.1s time resolution, the approaching proton will have experienced a nice gradual increase in repelling force as it approached, and your simulation looks a lot better.
 
  • #8
I understand that a smaller time step will increase the simulation accuracy, its not a physically accurate simulation its just for fun and self education, I'm using an arbitrary G constant to make a pleasing amount of particles move at a pleasing velocity with a reasonable framerate with vsync off rather than compensating for the fluctuating update rate.
This has the effect of the update rate slowing to compensate for the increased acceleration due to more particles and therefore more gravity, so with non linear scaling due to overhead and SIMD instructions, 2 particles at say 9000 FPS will move at a reasonable speed as will 4096 at 100 FPS.
But even with 2 particles at 9000 FPS moving slowly enough to keep track of them, the peak velocity of intercepting particles is just as inconsistent as 4096.

Rather than adding the memory overhead of more variables such as size and mass, maybe I could do some kind of linear interpolation to calculate the average force along the path between A and B but I don't know how to do that, any volunteers?
 
  • #9
It really depends what you're trying to get out of your simulation. If the goal is just something that looks reasonably convincing, then yeah, shortcuts like capping the force etc are totally fine. However, often those shortcuts send you into a one-way street that is hard to get out of when you are trying to extend your simulation. A shortcut that might have only affected your simulation imperceptibly originally, might make it useless further down the road.
 
  • #10
So there's no real solution to this? I thought some sort of interpolation might be the best way.
 

1. What is the concept of N-body random peak velocity of passing particles?

The N-body random peak velocity of passing particles refers to the maximum velocity attained by a group of particles moving randomly within a system of N bodies. This concept is commonly used in the study of dynamics and interactions between multiple particles in a given system.

2. How is the N-body random peak velocity of passing particles calculated?

The N-body random peak velocity of passing particles is calculated by taking the maximum velocity of each individual particle and then finding the average of these velocities. This average value represents the peak velocity of the group of particles as a whole.

3. What factors can affect the N-body random peak velocity of passing particles?

The N-body random peak velocity of passing particles can be affected by various factors such as the number and mass of the particles in the system, the size and shape of the system, and the initial conditions of the particles' velocities and positions. External forces, such as gravity or electromagnetic fields, can also influence the peak velocity of the particles.

4. How is the N-body random peak velocity of passing particles used in scientific research?

The N-body random peak velocity of passing particles is a useful tool in understanding the dynamics and behavior of systems with multiple interacting particles. It is commonly used in simulations and models to study the effects of different parameters on the overall behavior of the system.

5. Can the N-body random peak velocity of passing particles be observed in real-world systems?

While the concept of N-body random peak velocity of passing particles is often used in theoretical and computational studies, it can also be observed in real-world systems. Examples include the interactions between stars in a galaxy, the movement of gas particles in a confined space, and the behavior of molecules in a chemical reaction.

Similar threads

Replies
10
Views
901
  • High Energy, Nuclear, Particle Physics
Replies
2
Views
892
  • Programming and Computer Science
Replies
19
Views
2K
Replies
5
Views
1K
  • Set Theory, Logic, Probability, Statistics
Replies
10
Views
1K
  • Programming and Computer Science
Replies
15
Views
2K
  • Advanced Physics Homework Help
Replies
1
Views
1K
  • Special and General Relativity
Replies
27
Views
4K
  • Astronomy and Astrophysics
2
Replies
50
Views
3K
Replies
1
Views
1K
Back
Top