step_kdk.f 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106
  1. c*************************************************************************
  2. c STEP_KDK.F
  3. c*************************************************************************
  4. c This subroutine takes a step in helio coord.
  5. c both massive and test particles
  6. c
  7. c Input:
  8. c i1st ==> = 0 if first step; = 1 not (int scalar)
  9. c time ==> current time (real scalar)
  10. c nbod ==> number of massive bodies (int scalar)
  11. c ntp ==> number of massive bodies (int scalar)
  12. c mass ==> mass of bodies (real array)
  13. c j2rp2,j4rp4 ==> J2*radii_pl^2 and J4*radii_pl^4
  14. c (real scalars)
  15. c xh,yh,zh ==> initial position in helio coord
  16. c (real arrays)
  17. c vxh,vyh,vzh ==> initial velocity in helio coord
  18. c (real arrays)
  19. c xht,yht,zht ==> initial part position in helio coord
  20. c (real arrays)
  21. c vxht,vyht,vzht ==> initial velocity in helio coord
  22. c (real arrays)
  23. c istat ==> status of the test paricles
  24. c (2d integer array)
  25. c istat(i,1) = 0 ==> active: = 1 not
  26. c istat(i,2) = -1 ==> Danby did not work
  27. c rstat ==> status of the test paricles
  28. c (2d real array)
  29. c dt ==> time step
  30. c Output:
  31. c xh,yh,zh ==> final position in helio coord
  32. c (real arrays)
  33. c vxh,vyh,vzh ==> final velocity in helio coord
  34. c (real arrays)
  35. c xht,yht,zht ==> final position in helio coord
  36. c (real arrays)
  37. c vxht,vyht,vzht ==> final position in helio coord
  38. c (real arrays)
  39. c
  40. c
  41. c Remarks: Adopted from martin's nbwh.f program
  42. c Authors: Hal Levison
  43. c Date: 2/19/93
  44. c Last revision: 9/26/97
  45. subroutine step_kdk(i1st,time,nbod,ntp,mass,j2rp2,j4rp4,
  46. & xh,yh,zh,vxh,vyh,vzh,xht,yht,zht,vxht,vyht,vzht,
  47. & istat,rstat,dt)
  48. include '../../swift.inc'
  49. c... Inputs Only:
  50. integer nbod,ntp,i1st
  51. real*8 mass(nbod),dt,time,j2rp2,j4rp4
  52. c... Inputs and Outputs:
  53. integer istat(NTPMAX,NSTAT)
  54. real*8 rstat(NTPMAX,NSTATR)
  55. real*8 xh(nbod),yh(nbod),zh(nbod)
  56. real*8 vxh(nbod),vyh(nbod),vzh(nbod)
  57. real*8 xht(ntp),yht(ntp),zht(ntp)
  58. real*8 vxht(ntp),vyht(ntp),vzht(ntp)
  59. c... Internals
  60. integer i1sttp,i
  61. real*8 xbeg(NPLMAX),ybeg(NPLMAX),zbeg(NPLMAX)
  62. real*8 xend(NPLMAX),yend(NPLMAX),zend(NPLMAX)
  63. c----
  64. c... Executable code
  65. i1sttp = i1st
  66. c... remember the current position of the planets
  67. do i=1,nbod
  68. xbeg(i) = xh(i)
  69. ybeg(i) = yh(i)
  70. zbeg(i) = zh(i)
  71. enddo
  72. c... first do the planets
  73. call step_kdk_pl(i1st,nbod,mass,j2rp2,j4rp4,
  74. & xh,yh,zh,vxh,vyh,vzh,dt)
  75. if(ntp.ne.0) then
  76. c... now remember these positions
  77. do i=1,nbod
  78. xend(i) = xh(i)
  79. yend(i) = yh(i)
  80. zend(i) = zh(i)
  81. enddo
  82. c... next the test particles
  83. call step_kdk_tp(i1sttp,nbod,ntp,mass,j2rp2,j4rp4,
  84. & xbeg,ybeg,zbeg,xend,yend,zend,
  85. & xht,yht,zht,vxht,vyht,vzht,istat,dt)
  86. endif
  87. return
  88. end ! step_kdk
  89. c------------------------------------------------------------------------