N-body random peak velocity of passing particles

Click For Summary

Discussion Overview

The discussion revolves around challenges faced in simulating N-body interactions, particularly focusing on the peak velocities of particles as they pass each other. Participants explore various methods to improve simulation accuracy and address issues arising from particles' proximity during interactions. The conversation touches on theoretical aspects of gravitational interactions and practical considerations in simulation design.

Discussion Character

  • Exploratory
  • Technical explanation
  • Debate/contested
  • Mathematical reasoning

Main Points Raised

  • One participant notes that peak velocity changes based on the distance between particles at their closest approach, leading to unpredictable behaviors in the simulation.
  • Another suggests using a "particle clock" to adjust time resolution for each particle, potentially improving accuracy during strong gravitational interactions.
  • Some participants argue that the assumption of zero-sized particles leads to unrealistic force calculations, as it allows for arbitrarily small distances and large forces.
  • A participant provides a simplified example of two protons approaching each other, illustrating the impact of time resolution on force calculations and simulation outcomes.
  • One participant expresses that their simulation is not intended to be physically accurate but rather for fun and self-education, using arbitrary constants for gravitational interactions.
  • There is a suggestion to consider linear interpolation for calculating average forces between particles, although uncertainty remains about how to implement this effectively.
  • Another participant warns that shortcuts in simulation design, such as capping forces, may lead to complications in future developments of the simulation.

Areas of Agreement / Disagreement

Participants do not reach a consensus on a definitive solution to the simulation challenges. Multiple competing views on the best approach to improve accuracy and manage computational limitations remain evident throughout the discussion.

Contextual Notes

Limitations include the assumption of point-masses, which may not accurately reflect real-world interactions, and the unresolved nature of mathematical steps in the proposed solutions.

CommanderLake
Messages
4
Reaction score
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
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.
 
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.
 
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   Reactions: rumborak
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.
 
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
 
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.
 
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?
 
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.
 

Similar threads

  • · Replies 6 ·
Replies
6
Views
3K
  • · Replies 2 ·
Replies
2
Views
2K
  • · Replies 19 ·
Replies
19
Views
5K
  • · Replies 10 ·
Replies
10
Views
3K
  • · Replies 3 ·
Replies
3
Views
5K
  • · Replies 15 ·
Replies
15
Views
3K
  • · Replies 17 ·
Replies
17
Views
3K
  • · Replies 11 ·
Replies
11
Views
4K
  • · Replies 12 ·
Replies
12
Views
3K
  • · Replies 6 ·
Replies
6
Views
2K