symba5_chk.f 2.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374
  1. c*************************************************************************
  2. c SYMBA5_CHK.F
  3. c*************************************************************************
  4. c This subroutine checks to see if there are encounters
  5. c
  6. c Input:
  7. c rhill ==> Radius of hill sphere (real array)
  8. c nbod ==> number of massive bodies (int scalar)
  9. c ip1,ip2 ==> The two bodies to check (int scalar)
  10. c mass ==> mass of bodies (real array)
  11. c xh,yh,zh ==> initial position in helio coord
  12. c (real arrays)
  13. c vxh,vyh,vzh ==> initial velocity in helio coord
  14. c (real arrays)
  15. c dt ==> time step (real scalor)
  16. c irec ==> current recursion level (int scalar)
  17. c Output:
  18. c icflg ==> ecounter? = 1 Yes
  19. c = 0 No (integer scalar)
  20. c svdotr ==> = .true. if i,j are receding
  21. c = .false is approaching
  22. c (logical*1 scalar)
  23. c
  24. c Remarks: Based on plh_chk.f. Same as symba_chk.f
  25. c Authors: Hal Levison
  26. c Date: 3/20/97
  27. c Last revision:
  28. c
  29. subroutine symba5_chk(rhill,nbod,ip1,ip2,mass,xh,yh,zh,
  30. & vxh,vyh,vzh,dt,irec,icflg,svdotr)
  31. include '../swift.inc'
  32. include 'symba5.inc'
  33. c... Inputs:
  34. integer nbod,irec,ip1,ip2
  35. real*8 mass(nbod),xh(nbod),yh(nbod),zh(nbod),dt
  36. real*8 vxh(nbod),vyh(nbod),vzh(nbod),rhill(nbod)
  37. c... Outputs
  38. integer icflg
  39. logical*1 svdotr
  40. c... Internals
  41. real*8 r2crit,r2critp,rcrit
  42. real*8 xr,yr,zr,vxr,vyr,vzr
  43. real*8 vdotr
  44. c-----
  45. c... Executable code
  46. rcrit = (rhill(ip1)+rhill(ip2)) * RHSCALE * (RSHELL**(irec))
  47. r2crit = rcrit*rcrit
  48. r2critp = -1.0d0 ! not used here
  49. xr = xh(ip2) - xh(ip1)
  50. yr = yh(ip2) - yh(ip1)
  51. zr = zh(ip2) - zh(ip1)
  52. vxr = vxh(ip2) - vxh(ip1)
  53. vyr = vyh(ip2) - vyh(ip1)
  54. vzr = vzh(ip2) - vzh(ip1)
  55. call rmvs_chk_ind(xr,yr,zr,vxr,vyr,vzr,dt,
  56. & r2crit,r2critp,icflg)
  57. vdotr = xr*vxr + yr*vyr + zr*vzr
  58. svdotr = (vdotr.lt.0.0d0)
  59. return
  60. end ! symba5_chk
  61. c------------------------------------------------------