implementing a static potential

From: Jose Ariel Keselman <>
Date: Wed, 15 Oct 2008 17:34:20 +0200


I'm trying to implement a static potential to a galaxy-satellite
collision simulation -so far without success. Maybe you can
advise me how to make it work right... The potential is very simple,
just a point mass, its force given by F=M/R^2.

What I've done is the following - at the the end of function
"force_treeevaluate_shortrange()", before the comment

  /* store result at the proper place */
I've added the following lines:

double my_r = sqrt(pos_x*pos_x+pos_y*pos_y+pos_z*pos_z);
acc_x += -M*pos_x/my_r/my_r/my_r;

and the same for acc_y and acc_z.

Thanks in advance,

Jose Ariel Keselman
+972 4829 5558
Physics department
Received on 2008-10-15 17:34:22

This archive was generated by hypermail 2.3.0 : 2022-09-01 14:03:42 CEST