1
$\begingroup$

In an N-body simulation where forces between particles are attractive and particles do not lose energy on colliding with walls or each other, should energy be conserved? How could it be, with total kinetic energy increasing to unlimited values and total potential energy capped by the number of particles and their closest allowed proximity?

(I'm not sure if this is the correct forum to ask this, as it doesn't question the implementation mechanism itself. Feel free to tell me to repost it elsewhere.)

$\endgroup$
1
$\begingroup$

Think of the collisions between particles or walls as being modeled by a potential energy term of the form: $$U(r) = \begin{cases} 0, & \text{if $r > r_c$}, \\ +\infty, & \text{if $r \le r_c$}, \end{cases}$$ where $r_c$ is the radius of a particle (or wall). You can see that the energy goes to infinity, compensating the attractive forces. Another way of looking at the problem is to consider a sequence $U_n$ of smooth approximations to $U$ and to see that conservation of energy holds for every one of those approximations.

$\endgroup$
1
$\begingroup$

The numerical integration scheme might not be energy-preserving. The error term is often strictly positive, allowing for non-secular growth of the energy. There are some ways around this, such as conservative Runge-Kutta integrators.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.