getacch.f 2.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192
  1. c*************************************************************************
  2. c GETACCH.F
  3. c*************************************************************************
  4. c This subroutine calculates the acceleration on the massive particles
  5. c in the HELIOCENTRIC frame.
  6. c Input:
  7. c nbod ==> number of massive bodies (int scalor)
  8. c mass ==> mass of bodies (real array)
  9. c j2rp2,j4rp4 ==> J2*radii_pl^2 and J4*radii_pl^4
  10. c (real scalars)
  11. c xj,yj,zj ==> position in jacobi coord (real arrays)
  12. c xh,yh,zh ==> position in heliocentric coord (real arrays)
  13. c Output:
  14. c axh,ayh,azh ==> acceleration in helio coord (real arrays)
  15. c
  16. c Author: Hal Levison
  17. c Date: 2/2/93
  18. c Last revision: 2/18/93
  19. subroutine getacch(nbod,mass,j2rp2,j4rp4,xj,yj,zj,
  20. & xh,yh,zh,axh,ayh,azh)
  21. include '../../swift.inc'
  22. c... Inputs:
  23. integer nbod
  24. real*8 mass(NPLMAX),xj(NPLMAX),yj(NPLMAX),zj(NPLMAX),j2rp2,j4rp4
  25. real*8 xh(NPLMAX),yh(NPLMAX),zh(NPLMAX)
  26. c... Outputs:
  27. real*8 axh(NPLMAX),ayh(NPLMAX),azh(NPLMAX)
  28. c... Internals:
  29. integer i
  30. real*8 ir3h(NPLMAX),ir3j(NPLMAX)
  31. real*8 irh(NPLMAX),irj(NPLMAX)
  32. real*8 axh1(NPLMAX),ayh1(NPLMAX),azh1(NPLMAX)
  33. real*8 axh2(NPLMAX),ayh2(NPLMAX),azh2(NPLMAX)
  34. real*8 axh3(NPLMAX),ayh3(NPLMAX),azh3(NPLMAX)
  35. real*8 axh0,ayh0,azh0
  36. real*8 aoblx(NPLMAX),aobly(NPLMAX),aoblz(NPLMAX)
  37. c----
  38. c... Executable code
  39. c... get thr r^-3's
  40. call getacch_ir3(nbod,2,xj,yj,zj,ir3j,irj)
  41. call getacch_ir3(nbod,2,xh,yh,zh,ir3h,irh)
  42. c... calc the ah0's: recall that they are the same for all particles
  43. call getacch_ah0(3,nbod,mass,xh,yh,zh,ir3h,axh0,ayh0,azh0)
  44. c... now the first terms
  45. call getacch_ah1(nbod,mass,xh,yh,zh,xj,yj,zj,ir3h,ir3j,
  46. & axh1,ayh1,azh1)
  47. c... now the second terms
  48. call getacch_ah2(nbod,mass,xj,yj,zj,ir3j,axh2,ayh2,azh2)
  49. c... now the third terms
  50. call getacch_ah3(nbod,mass,xh,yh,zh,axh3,ayh3,azh3)
  51. c... add them all together
  52. axh(1) = 0.0
  53. ayh(1) = 0.0
  54. azh(1) = 0.0
  55. do i=2,nbod
  56. axh(i) = axh0 + axh1(i) + axh2(i) + axh3(i)
  57. ayh(i) = ayh0 + ayh1(i) + ayh2(i) + ayh3(i)
  58. azh(i) = azh0 + azh1(i) + azh2(i) + azh3(i)
  59. enddo
  60. c... Now do j2 and j4 stuff
  61. if(j2rp2.ne.0.0d0) then
  62. call obl_acc(nbod,mass,j2rp2,j4rp4,xh,yh,zh,irh,
  63. & aoblx,aobly,aoblz)
  64. do i = 2,nbod
  65. axh(i) = axh(i) + aoblx(i) - aoblx(1)
  66. ayh(i) = ayh(i) + aobly(i) - aobly(1)
  67. azh(i) = azh(i) + aoblz(i) - aoblz(1)
  68. enddo
  69. endif
  70. return
  71. end ! getacch
  72. c---------------------------------------------------------------------