implementing a static potential

From: Jose Ariel Keselman <kari_at_techunix.technion.ac.il>
Date: Wed, 15 Oct 2008 17:34:20 +0200

Hi,

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,
Ariel.

-----------------------------
Jose Ariel Keselman
kari_at_tx.technion.ac.il
+972 4829 5558
Physics department
Technion
Received on 2008-10-15 17:34:22

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