lyap2_acc_tp.f 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114
  1. c*************************************************************************
  2. c LYAP2_ACC_TP.F
  3. c*************************************************************************
  4. c This subroutine calculates the delta acceleration on the test particles
  5. c for difference equations
  6. c Input:
  7. c nbod ==> number of massive bodies (int scalor)
  8. c ntp ==> number of tp bodies (int scalor)
  9. c mass ==> mass of bodies (real array)
  10. c j2rp2,j4rp4 ==> J2*radii_pl^2 and J4*radii_pl^4
  11. c (real scalars)
  12. c xh,yh,zh ==> massive part position in helio coord
  13. c (real arrays)
  14. c xht,yht,zht ==> test part position in heliocentric coord
  15. c (real arrays)
  16. c dxht,dyht,dzht ==> separation in position
  17. c (real arrays)
  18. c istat ==> status of the test paricles
  19. c (integer array)
  20. c istat(i) = 0 ==> active: = 1 not
  21. c NOTE: it is really a 2d array but
  22. c we only use the 1st row
  23. c Output:
  24. c daxht,dayht,dazht ==> tp delta acceleration in helio coord
  25. c (real arrays)
  26. c
  27. c Comments: Based on getacch_tp
  28. c Author: Hal Levison
  29. c Date: 7/11/95
  30. c Last revision:
  31. subroutine lyap2_acc_tp(nbod,ntp,mass,j2rp2,j4rp4,xh,yh,zh,
  32. & xht,yht,zht,dxht,dyht,dzht,istat,daxht,dayht,dazht)
  33. include '../swift.inc'
  34. c... Inputs:
  35. integer nbod,ntp,istat(NTPMAX)
  36. real*8 mass(NPLMAX),xh(NPLMAX),yh(NPLMAX),zh(NPLMAX)
  37. real*8 xht(NTPMAX),yht(NTPMAX),zht(NTPMAX),j2rp2,j4rp4
  38. real*8 dxht(NTPMAX),dyht(NTPMAX),dzht(NTPMAX)
  39. c... Outputs:
  40. real*8 daxht(NTPMAX),dayht(NTPMAX),dazht(NTPMAX)
  41. c... Internals:
  42. integer i,j
  43. real*8 rx,ry,rz,rji2,irij3,irij5
  44. real*8 t1,t2,t3
  45. c----
  46. c... Executable code
  47. c... the 0th term is zero
  48. c... the first terms are 0
  49. c... the second terms are 0
  50. c... now the third terms
  51. do i=1,ntp
  52. daxht(i) = 0.0
  53. dayht(i) = 0.0
  54. dazht(i) = 0.0
  55. enddo
  56. do j=1,ntp
  57. if(istat(j).eq.0) then
  58. do i=2,nbod
  59. rx = xht(j) - xh(i)
  60. ry = yht(j) - yh(i)
  61. rz = zht(j) - zh(i)
  62. rji2 = rx*rx + ry*ry + rz*rz
  63. irij3 = 1.0d0/(rji2*sqrt(rji2))
  64. irij5 = irij3/(rji2)
  65. c... x
  66. t1 = dxht(j)*(-irij3 + 3.0*rx*rx*irij5)
  67. t2 = 3.0*rx*ry*irij5*dyht(j)
  68. t3 = 3.0*rx*rz*irij5*dzht(j)
  69. daxht(j) = daxht(j) + mass(i)*(t1+t2+t3)
  70. c... y
  71. t1 = 3.0*rx*ry*irij5*dxht(j)
  72. t2 = (-irij3 + 3.0*ry*ry*irij5)*dyht(j)
  73. t3 = 3.0*ry*rz*irij5*dzht(j)
  74. dayht(j) = dayht(j) + mass(i)*(t1+t2+t3)
  75. c... z
  76. t1 = 3.0*rx*rz*irij5*dxht(j)
  77. t2 = 3.0*ry*rz*irij5*dyht(j)
  78. t3 = (-irij3 + 3.0*rz*rz*irij5)*dzht(j)
  79. dazht(j) = dazht(j) + mass(i)*(t1+t2+t3)
  80. enddo
  81. endif
  82. enddo
  83. c... Now do j2 and j4 stuff
  84. c... Not included in this version !!!!!!
  85. return
  86. end ! lyap2_acc_tp
  87. c---------------------------------------------------------------------