step_kdk_tp.f 3.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192
  1. c*************************************************************************
  2. c STEP_KDK_TP.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 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 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 dt ==> time step
  28. c Output:
  29. c xht,yht,zht ==> final position in helio coord
  30. c (real arrays)
  31. c vxht,vyht,vzht ==> final position in helio coord
  32. c (real arrays)
  33. c
  34. c Remarks: Adopted from martin's nbwhnew.f program
  35. c Authors: Hal Levison
  36. c Date: 2/12/93
  37. c Last revision: 2/24/94
  38. subroutine step_kdk_tp(i1st,nbod,ntp,mass,j2rp2,j4rp4,
  39. & xbeg,ybeg,zbeg,xend,yend,zend,
  40. & xht,yht,zht,vxht,vyht,vzht,istat,dt)
  41. include '../../swift.inc'
  42. c... Inputs Only:
  43. integer nbod,ntp,i1st
  44. real*8 mass(nbod),dt,j2rp2,j4rp4
  45. real*8 xbeg(NPLMAX),ybeg(NPLMAX),zbeg(NPLMAX)
  46. real*8 xend(NPLMAX),yend(NPLMAX),zend(NPLMAX)
  47. c... Inputs and Outputs:
  48. integer istat(NTPMAX,NSTAT)
  49. real*8 xht(ntp),yht(ntp),zht(ntp)
  50. real*8 vxht(ntp),vyht(ntp),vzht(ntp)
  51. c... Internals:
  52. c integer i
  53. real*8 dth
  54. real*8 axht(NTPMAX),ayht(NTPMAX),azht(NTPMAX)
  55. save axht,ayht,azht ! Note this !!
  56. c----
  57. c... Executable code
  58. dth = 0.5d0*dt
  59. if(i1st.eq.0) then
  60. c... Get the accelerations in helio frame.
  61. call getacch_tp(nbod,ntp,mass,j2rp2,j4rp4,xbeg,ybeg,zbeg,
  62. & xht,yht,zht,istat,axht,ayht,azht)
  63. i1st = 1 ! turn this off
  64. endif
  65. c... Apply a heliocentric kick for a half dt
  66. call kickvh_tp(ntp,vxht,vyht,vzht,axht,ayht,azht,istat,dth)
  67. c... Take a drift forward full step
  68. call drift_tp(ntp,mass(1),xht,yht,zht,vxht,vyht,vzht,dt,istat)
  69. c... Get the accelerations in helio frame.
  70. call getacch_tp(nbod,ntp,mass,j2rp2,j4rp4,xend,yend,zend,
  71. & xht,yht,zht,istat,axht,ayht,azht)
  72. c... Apply a heliocentric kick for a half dt
  73. call kickvh_tp(ntp,vxht,vyht,vzht,axht,ayht,azht,istat,dth)
  74. return
  75. end ! step_kdk_tp
  76. c---------------------------------------------------------------------