getacch_ah3_tp.f 2.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677
  1. c*************************************************************************
  2. c GETACCH_A3_TP.F
  3. c*************************************************************************
  4. c This subroutine calculates the 3rd term acceleration on the test particles
  5. c in the HELIOCENTRIC frame. This term is the direct cross terms
  6. c Input:
  7. c nbod ==> number of massive bodies (int scalor)
  8. c ntp ==> number of test particles (int scalor)
  9. c mass ==> mass of massive bodies (real array)
  10. c xh,yh,zh ==> massive position in heliocentric coord
  11. c (real arrays)
  12. c xht,yht,zht ==> tp position in heliocentric coord
  13. c (real arrays)
  14. c istat ==> status of the test paricles
  15. c (integer array)
  16. c istat(i) = 0 ==> active: = 1 not
  17. c NOTE: it is really a 2d array but
  18. c we only use the 1st row
  19. c Output:
  20. c axh3,ayh3,azh3 ==> 3rd term of acceleration in helio coord
  21. c (real arrays)
  22. c
  23. c Author: Hal Levison
  24. c Date: 2/18/93
  25. c Last revision:
  26. subroutine getacch_ah3_tp(nbod,ntp,mass,xh,yh,zh,xht,yht,zht,
  27. & istat,axh3,ayh3,azh3)
  28. include '../../swift.inc'
  29. c... Inputs:
  30. integer nbod,ntp,istat(NTPMAX)
  31. real*8 mass(NPLMAX),xh(NPLMAX),yh(NPLMAX),zh(NPLMAX)
  32. real*8 xht(NTPMAX),yht(NTPMAX),zht(NTPMAX)
  33. c... Outputs:
  34. real*8 axh3(NTPMAX),ayh3(NTPMAX),azh3(NTPMAX)
  35. c... Internals:
  36. integer i,j
  37. real*8 dx,dy,dz,rji2,fac,irij3
  38. c------
  39. c... Executable code
  40. do i=1,ntp
  41. axh3(i) = 0.0
  42. ayh3(i) = 0.0
  43. azh3(i) = 0.0
  44. enddo
  45. do j=1,ntp
  46. if(istat(j).eq.0) then
  47. do i=2,nbod
  48. dx = xht(j) - xh(i)
  49. dy = yht(j) - yh(i)
  50. dz = zht(j) - zh(i)
  51. rji2 = dx*dx + dy*dy + dz*dz
  52. irij3 = 1.0d0/(rji2*sqrt(rji2))
  53. fac = mass(i)*irij3
  54. axh3(j) = axh3(j) - fac*dx
  55. ayh3(j) = ayh3(j) - fac*dy
  56. azh3(j) = azh3(j) - fac*dz
  57. enddo
  58. endif
  59. enddo
  60. return
  61. end ! getacch_ah3_tp
  62. c--------------------------------------------------------------------------