drift_kepu_guess.f 2.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  1. c*************************************************************************
  2. c DRIFT_KEPU_GUESS.F
  3. c*************************************************************************
  4. c Initial guess for solving kepler's equation using universal variables.
  5. c
  6. c Input:
  7. c dt ==> time step (real scalor)
  8. c r0 ==> Distance between `Sun' and paritcle
  9. c (real scalor)
  10. c mu ==> Reduced mass of system (real scalor)
  11. c alpha ==> energy (real scalor)
  12. c u ==> angular momentun (real scalor)
  13. c Output:
  14. c s ==> initial guess for the value of
  15. c universal variable
  16. c
  17. c Author: Hal Levison & Martin Duncan
  18. c Date: 3/12/93
  19. c Last revision: April 6/93
  20. subroutine drift_kepu_guess(dt,r0,mu,alpha,u,s)
  21. include '../../swift.inc'
  22. c... Inputs:
  23. real*8 dt,r0,mu,alpha,u
  24. c... Inputs and Outputs:
  25. real*8 s
  26. c... Internals:
  27. integer iflg
  28. real*8 y,sy,cy,sigma,es
  29. real*8 x,a
  30. real*8 en,ec,e
  31. c----
  32. c... Executable code
  33. if (alpha.gt.0.0) then
  34. c... find initial guess for elliptic motion
  35. if( dt/r0 .le. 0.4) then
  36. s = dt/r0 - (dt*dt*u)/(2.0*r0*r0*r0)
  37. return
  38. else
  39. a = mu/alpha
  40. en = sqrt(mu/(a*a*a))
  41. ec = 1.0 - r0/a
  42. es = u/(en*a*a)
  43. e = sqrt(ec*ec + es*es)
  44. y = en*dt - es
  45. call orbel_scget(y,sy,cy)
  46. sigma = dsign(1.d0,(es*cy + ec*sy))
  47. x = y + sigma*.85*e
  48. s = x/sqrt(alpha)
  49. endif
  50. else
  51. c... find initial guess for hyperbolic motion.
  52. call drift_kepu_p3solve(dt,r0,mu,alpha,u,s,iflg)
  53. if(iflg.ne.0) then
  54. s = dt/r0
  55. endif
  56. endif
  57. return
  58. end ! drift_kepu_guess
  59. c-------------------------------------------------------------------