lyap2_step_tp.f 4.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112
  1. c*************************************************************************
  2. c LYAP2_STEP_TP
  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 TEST 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 ntp ==> number of test 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 xbeg,ybeg,zbeg ==> massive part position at beginning of dt
  16. c (real arrays)
  17. c xend,yend,zend ==> massive part position at end of dt
  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 dxht,dyht,dzht ==> initial separation in position
  24. c (real arrays)
  25. c dvxht,dvyht,dvzht ==> initial separation in velocity
  26. c (real arrays)
  27. c istat ==> status of the test paricles
  28. c (2d integer array)
  29. c istat(i,1) = 0 ==> active: = 1 not
  30. c istat(i,2) = -1 ==> Danby did not work
  31. c dt ==> time step
  32. c Output:
  33. c xht,yht,zht ==> final position in helio coord
  34. c (real arrays)
  35. c vxht,vyht,vzht ==> final position in helio coord
  36. c (real arrays)
  37. c dxht,dyht,dzht ==> final separation in position
  38. c (real arrays)
  39. c dvxht,dvyht,dvzht ==> final separation in velocity
  40. c (real arrays)
  41. c
  42. c Remarks: Adopted from step_kdk_tp.f
  43. c Authors: Hal Levison
  44. c Date: 7/11/95
  45. c Last revision:
  46. subroutine lyap2_step_tp(i1st,nbod,ntp,mass,j2rp2,j4rp4,
  47. & xbeg,ybeg,zbeg,xend,yend,zend,
  48. & xht,yht,zht,vxht,vyht,vzht,
  49. & dxht,dyht,dzht,dvxht,dvyht,dvzht,istat,dt)
  50. include '../swift.inc'
  51. c... Inputs Only:
  52. integer nbod,ntp,i1st
  53. real*8 mass(nbod),dt,j2rp2,j4rp4
  54. real*8 xbeg(NPLMAX),ybeg(NPLMAX),zbeg(NPLMAX)
  55. real*8 xend(NPLMAX),yend(NPLMAX),zend(NPLMAX)
  56. c... Inputs and Outputs:
  57. integer istat(NTPMAX,NSTAT)
  58. real*8 xht(ntp),yht(ntp),zht(ntp)
  59. real*8 vxht(ntp),vyht(ntp),vzht(ntp)
  60. real*8 dxht(ntp),dyht(ntp),dzht(ntp)
  61. real*8 dvxht(ntp),dvyht(ntp),dvzht(ntp)
  62. c... Internals:
  63. c integer i
  64. real*8 dth
  65. real*8 axht(NTPMAX),ayht(NTPMAX),azht(NTPMAX)
  66. real*8 daxht(NTPMAX),dayht(NTPMAX),dazht(NTPMAX)
  67. save axht,ayht,azht ! Note this !!
  68. save daxht,dayht,dazht ! Note this !!
  69. c----
  70. c... Executable code
  71. dth = 0.5d0*dt
  72. if(i1st.eq.0) then
  73. c... Get the accelerations in helio frame.
  74. call getacch_tp(nbod,ntp,mass,j2rp2,j4rp4,xbeg,ybeg,zbeg,
  75. & xht,yht,zht,istat,axht,ayht,azht)
  76. call lyap2_acc_tp(nbod,ntp,mass,j2rp2,j4rp4,xbeg,ybeg,zbeg,
  77. & xht,yht,zht,dxht,dyht,dzht,istat,daxht,dayht,dazht)
  78. i1st = 1 ! turn this off
  79. endif
  80. c... Apply a heliocentric kick for a half dt
  81. call kickvh_tp(ntp,vxht,vyht,vzht,axht,ayht,azht,istat,dth)
  82. call kickvh_tp(ntp,dvxht,dvyht,dvzht,daxht,dayht,dazht,istat,dth)
  83. c... Take a drift forward full step
  84. call lyap2_drift_tp(ntp,mass(1),xht,yht,zht,vxht,vyht,vzht,dxht,
  85. & dyht,dzht,dvxht,dvyht,dvzht,dt,istat)
  86. c... Get the accelerations in helio frame.
  87. call getacch_tp(nbod,ntp,mass,j2rp2,j4rp4,xend,yend,zend,
  88. & xht,yht,zht,istat,axht,ayht,azht)
  89. call lyap2_acc_tp(nbod,ntp,mass,j2rp2,j4rp4,xend,yend,zend,
  90. & xht,yht,zht,dxht,dyht,dzht,istat,daxht,dayht,dazht)
  91. c... Apply a heliocentric kick for a half dt
  92. call kickvh_tp(ntp,vxht,vyht,vzht,axht,ayht,azht,istat,dth)
  93. call kickvh_tp(ntp,dvxht,dvyht,dvzht,daxht,dayht,dazht,istat,dth)
  94. return
  95. end ! lyap2_step_tp
  96. c---------------------------------------------------------------------