obl_acc_tp.f 2.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879
  1. c***************************************************************************
  2. c OBL_ACC_TP.F
  3. c*************************************************************************
  4. c OBL_ACC returns the BARYCENTRIC x,y,z components of the acc. on NTP
  5. c test particles due to the oblateness of mass(1) using
  6. c the values of J2RP2 and J4RP4 passed into the routine.
  7. c (J2RP2 for example is the product of
  8. c J_2 times the square of the central body's radius)
  9. c Here we return the net acc. produced
  10. c only by the J2 and J4 terms (i.e. including
  11. c neither the monopole nor higher order terms).
  12. c
  13. c
  14. c Input:
  15. c ntp ==> number of massive bodies (incl. central one)
  16. c istat ==> status of the test paricles
  17. c (integer array)
  18. c istat(i) = 0 ==> active: = 1 not
  19. c NOTE: it is really a 2d array but
  20. c we only use the 1st row
  21. c msun ==> mass of the central particle (real*8 scalar)
  22. c j2rp2 ==> scaled value of j2 moment (real*8 scalar)
  23. c j4rp4 ==> scaled value of j4 moment (real*8 scalar)
  24. c xht(*),yht(*),zht(*) ==> HELIO. positions of particles
  25. c irht(*) ==> 1./ magnitude of radius vector (real*8 vector)
  26. c (passed in to save calcs.)
  27. c Output:
  28. c aoblxt(*),aoblyt(*),aoblzt(*) ==> BARY. components of accel
  29. c (real*8 vectors)
  30. c
  31. c Remarks: Based on Martin's OBL_ACC.F
  32. c Authors: Hal Levison
  33. c Date: 3/4/94
  34. c Last revision:
  35. subroutine obl_acc_tp(ntp,istat,msun,j2rp2,j4rp4,xht,yht,zht,
  36. & irht,aoblxt,aoblyt,aoblzt)
  37. include '../swift.inc'
  38. c... Inputs Only:
  39. integer ntp,istat(ntp)
  40. real*8 msun,j2rp2,j4rp4
  41. real*8 xht(ntp),yht(ntp),zht(ntp),irht(NPLMAX)
  42. c... Output
  43. real*8 aoblxt(ntp),aoblyt(ntp),aoblzt(ntp)
  44. c... Internals
  45. integer n
  46. real*8 rinv2,t0,t1,t2,t3
  47. real*8 fac1,fac2
  48. c----
  49. c... executable code
  50. c First get the bary acc. of each tp due to central oblate "sun"
  51. do n =1,ntp
  52. rinv2= irht(n)**2
  53. t0 = -msun*rinv2*rinv2*irht(n)
  54. t1 = 1.5d0 *j2rp2
  55. t2 = zht(n)*zht(n)*rinv2
  56. t3 = 1.875d0 *j4rp4*rinv2
  57. fac1 = t0*(t1 - t3 - (5.d0*t1 - (14.d0 - 21.d0*t2)*t3)*t2)
  58. fac2 = 2.d0*t0*(t1 - (2.d0 - (14.d0*t2/3.d0))*t3)
  59. aoblxt(n) = fac1*xht(n)
  60. aoblyt(n) = fac1*yht(n)
  61. aoblzt(n) = (fac1 + fac2)*zht(n)
  62. enddo
  63. return
  64. end ! obl_acc_tp.f
  65. c____________________________________________________________________________