Re: potential energy calc

From: Volker Springel <volker_at_MPA-Garching.MPG.DE>
Date: Fri, 18 May 2007 12:08:49 +0200

Paul Taylor wrote:
> Hi,
> I have a question about calculating the individual potential of a
> particle; where this is done in potential.c, the 'self-potential' is
> removed as follows:
> <<
> /* add correction to exclude self-potential */
> for(i = 0; i < NumPart; i++)
> {
> /* remove self-potential */
> P[i].Potential += P[i].Mass / All.SofteningTable[P[i].Type];
> ....
> I am using adaptive softening, and so I wondered if it might make more
> sense to divide by the SphP[i].Hsml or by (2.8 * SphP[i].Hsml) instead
> of the softening table value, since then the representative value would
> be adaptive as well; ie, the line would look like:
> <<
> P[i].Potential += P[i].Mass / (SphP[i].Hsml)
> Does anyone have thoughts/objections to this? I guess the Hsml might be
> too big for this purpose, so then it could just be a parameter times
> Hsml in the denominator, but something to keep it adaptive with the
> softening.

Hi Paul,

Right, I guess it would make sense to subtract the self-potential with
the adaptive softening in this case. After all, that's what's also added
in when the tree is walked in the first place. But it should then be
P[i].Potential += P[i].Mass / (SphP[i].Hsml / 2.8).

In general, subtracting the self-potential is done by convention, based
on the idea that the potential energy should be normalized to zero when
all particles are infinitely far away from each other. But other choices
for normalization would also be valid.

Things become more tricky however when you vary the gravitational
softening. Unlike for a constant softening, your system will then not be
conservative any more, because this also changes in principle the
gravitational potential energy. One can work around this by including
suitable correction terms in the force equation, see for example the
paper by Price & Monaghan, 2007, MN, 374, 1347.


> Cheers,
> PT
> -----------------------------------------------------------
> If you wish to unsubscribe from this mailing, send mail to
> with a subject of: unsubscribe gadget-list
> A web-archive of this mailing list is available here:
Received on 2007-05-18 12:09:10

This archive was generated by hypermail 2.3.0 : 2023-01-10 10:01:30 CET