helio_step_pl.f 5.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149
  1. c*************************************************************************
  2. c HELIO_STEP_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 xbeg,ybeg,zbeg ==> position at beginning of drift
  25. c (real arrays)
  26. c xend,yend,zend ==> position at end of drift
  27. c (real arrays)
  28. c vxbeg,vybeg,vzbeg ==> velocity at beginning of drift
  29. c (real arrays)
  30. c vxend,vyend,vzend ==> velocity at end of drift
  31. c (real arrays)
  32. c ptxb,ptyb,ptzb ==> beg momentum of sun: tp's need this
  33. c (real scalars)
  34. c ptxe,ptye,ptze ==> end momentum of sun: tp's need this
  35. c (real scalars)
  36. c vxsb,vxsb,vxsb ==> Initial vel of the Sun: tp's need this
  37. c (real scalars)
  38. c vxse,vxse,vxse ==> final vel of the Sun: tp's need this
  39. c (real scalars)
  40. c
  41. c Remarks: Based on step_kdk_pl.f
  42. c Authors: Hal Levison
  43. c Date: 10/14/96
  44. c Last revision:
  45. subroutine helio_step_pl(i1st,nbod,mass,j2rp2,j4rp4,
  46. & xh,yh,zh,vxh,vyh,vzh,dt,xbeg,ybeg,zbeg,
  47. & xend,yend,zend,vxbeg,vybeg,vzbeg,
  48. & vxend,vyend,vzend,ptxb,ptyb,ptzb,ptxe,ptye,
  49. & ptze,vxsb,vysb,vzsb,vxse,vyse,vzse)
  50. include '../swift.inc'
  51. c... Inputs Only:
  52. integer nbod,i1st
  53. real*8 mass(nbod),dt,j2rp2,j4rp4
  54. c... Inputs and Outputs:
  55. real*8 xh(nbod),yh(nbod),zh(nbod)
  56. real*8 vxh(nbod),vyh(nbod),vzh(nbod)
  57. c... Outputs Only:
  58. real*8 ptxb,ptyb,ptzb
  59. real*8 ptxe,ptye,ptze
  60. real*8 vxsb,vysb,vzsb,vxse,vyse,vzse
  61. real*8 xbeg(NPLMAX),ybeg(NPLMAX),zbeg(NPLMAX)
  62. real*8 xend(NPLMAX),yend(NPLMAX),zend(NPLMAX)
  63. real*8 vxbeg(NPLMAX),vybeg(NPLMAX),vzbeg(NPLMAX)
  64. real*8 vxend(NPLMAX),vyend(NPLMAX),vzend(NPLMAX)
  65. c... Internals:
  66. integer i
  67. real*8 dth
  68. real*8 axh(NPLMAX),ayh(NPLMAX),azh(NPLMAX)
  69. real*8 vxb(NPLMAX),vyb(NPLMAX),vzb(NPLMAX),msys
  70. save axh,ayh,azh ! Note this !!
  71. save vxb,vyb,vzb ! Note this !!
  72. c----
  73. c... Executable code
  74. dth = 0.5d0*dt
  75. if(i1st.eq.0) then
  76. c... Convert vel to bery to jacobi coords
  77. call coord_vh2b(nbod,mass,vxh,vyh,vzh,vxb,vyb,vzb,msys)
  78. i1st = 1 ! turn this off
  79. endif
  80. vxsb = vxb(1)
  81. vysb = vyb(1)
  82. vzsb = vzb(1)
  83. c... Do the linear drift due to momentum of the Sun
  84. call helio_lindrift(nbod,mass,vxb,vyb,vzb,dth,
  85. & xh,yh,zh,ptxb,ptyb,ptzb)
  86. c... Get the accelerations in helio frame. if frist time step
  87. call helio_getacch(nbod,mass,j2rp2,j4rp4,xh,yh,zh,axh,ayh,azh)
  88. c... Apply a heliocentric kick for a half dt
  89. call kickvh(nbod,vxb,vyb,vzb,axh,ayh,azh,dth)
  90. c... remember the current position of the planets
  91. do i=1,nbod
  92. xbeg(i) = xh(i)
  93. ybeg(i) = yh(i)
  94. zbeg(i) = zh(i)
  95. vxbeg(i) = vxb(i)
  96. vybeg(i) = vyb(i)
  97. vzbeg(i) = vzb(i)
  98. enddo
  99. c.. Drift in Jacobi coords for the full step
  100. call helio_drift(nbod,mass,xh,yh,zh,vxb,vyb,vzb,dt)
  101. c... now remember these positions
  102. do i=1,nbod
  103. xend(i) = xh(i)
  104. yend(i) = yh(i)
  105. zend(i) = zh(i)
  106. vxend(i) = vxb(i)
  107. vyend(i) = vyb(i)
  108. vzend(i) = vzb(i)
  109. enddo
  110. c... Get the accelerations in helio frame. if frist time step
  111. call helio_getacch(nbod,mass,j2rp2,j4rp4,xh,yh,zh,axh,ayh,azh)
  112. c... Apply a heliocentric kick for a half dt
  113. call kickvh(nbod,vxb,vyb,vzb,axh,ayh,azh,dth)
  114. c... Do the linear drift due to momentum of the Sun
  115. call helio_lindrift(nbod,mass,vxb,vyb,vzb,dth,
  116. & xh,yh,zh,ptxe,ptye,ptze)
  117. c... convert back to helio velocities
  118. call coord_vb2h(nbod,mass,vxb,vyb,vzb,vxh,vyh,vzh)
  119. vxse = vxb(1)
  120. vyse = vyb(1)
  121. vzse = vzb(1)
  122. return
  123. end ! helio_step_pl
  124. c---------------------------------------------------------------------