step_kdk_pl.f 3.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889
  1. c*************************************************************************
  2. c STEP_KDK_PL.F
  3. c*************************************************************************
  4. c This subroutine takes a step in helio coord.
  5. c Does a KICK than a DRIFT than a KICK.
  6. c ONLY DOES MASSIVE PARTICLES
  7. c
  8. c Input:
  9. c i1st ==> = 0 if first step; = 1 not (int scalar)
  10. c nbod ==> number of massive bodies (int scalar)
  11. c mass ==> mass of bodies (real array)
  12. c j2rp2,j4rp4 ==> J2*radii_pl^2 and J4*radii_pl^4
  13. c (real scalars)
  14. c xh,yh,zh ==> initial position in helio coord
  15. c (real arrays)
  16. c vxh,vyh,vzh ==> initial velocity in helio coord
  17. c (real arrays)
  18. c dt ==> time step
  19. c Output:
  20. c xh,yh,zh ==> final position in helio coord
  21. c (real arrays)
  22. c vxh,vyh,vzh ==> final velocity in helio coord
  23. c (real arrays)
  24. c
  25. c Remarks: Adopted from martin's nbwhnew.f program
  26. c Authors: Hal Levison
  27. c Date: 2/12/93
  28. c Last revision: 2/24/94
  29. subroutine step_kdk_pl(i1st,nbod,mass,j2rp2,j4rp4,
  30. & xh,yh,zh,vxh,vyh,vzh,dt)
  31. include '../../swift.inc'
  32. c... Inputs Only:
  33. integer nbod,i1st
  34. real*8 mass(nbod),dt,j2rp2,j4rp4
  35. c... Inputs and Outputs:
  36. real*8 xh(nbod),yh(nbod),zh(nbod)
  37. real*8 vxh(nbod),vyh(nbod),vzh(nbod)
  38. c... Internals:
  39. real*8 dth
  40. real*8 axh(NPLMAX),ayh(NPLMAX),azh(NPLMAX)
  41. real*8 xj(NPLMAX),yj(NPLMAX),zj(NPLMAX)
  42. real*8 vxj(NPLMAX),vyj(NPLMAX),vzj(NPLMAX)
  43. save axh,ayh,azh,xj,yj,zj ! Note this !!
  44. c----
  45. c... Executable code
  46. dth = 0.5d0*dt
  47. if(i1st.eq.0) then
  48. c... Convert to jacobi coords
  49. call coord_h2j(nbod,mass,xh,yh,zh,vxh,vyh,vzh,
  50. & xj,yj,zj,vxj,vyj,vzj)
  51. c... Get the accelerations in helio frame. if frist time step
  52. call getacch(nbod,mass,j2rp2,j4rp4,xj,yj,zj,
  53. & xh,yh,zh,axh,ayh,azh)
  54. i1st = 1 ! turn this off
  55. endif
  56. c... Apply a heliocentric kick for a half dt
  57. call kickvh(nbod,vxh,vyh,vzh,axh,ayh,azh,dth)
  58. c... Convert the helio. vels. to Jac. vels. (the Jac. positions are unchanged)
  59. call coord_vh2vj(nbod,mass,vxh,vyh,vzh,vxj,vyj,vzj)
  60. c.. Drift in Jacobi coords for the full step
  61. call drift(nbod,mass,xj,yj,zj,vxj,vyj,vzj,dt)
  62. c... After drift, compute helio. xh and vh for acceleration calculations
  63. call coord_j2h(nbod,mass,xj,yj,zj,vxj,vyj,vzj,
  64. & xh,yh,zh,vxh,vyh,vzh)
  65. c... Get the accelerations in helio frame.
  66. call getacch(nbod,mass,j2rp2,j4rp4,xj,yj,zj,xh,yh,zh,axh,ayh,azh)
  67. c... Apply a heliocentric kick for a half dt
  68. call kickvh(nbod,vxh,vyh,vzh,axh,ayh,azh,dth)
  69. return
  70. end ! step_kdk_pl
  71. c---------------------------------------------------------------------