orbel_zget.f 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. ***********************************************************************
  2. c ORBEL_ZGET.F
  3. ***********************************************************************
  4. * PURPOSE: Solves the equivalent of Kepler's eqn. for a parabola
  5. * given Q (Fitz. notation.)
  6. *
  7. * Input:
  8. * q ==> parabola mean anomaly. (real scalar)
  9. * Returns:
  10. * orbel_zget ==> eccentric anomaly. (real scalar)
  11. *
  12. * ALGORITHM: p. 70-72 of Fitzpatrick's book "Princ. of Cel. Mech."
  13. * REMARKS: For a parabola we can solve analytically.
  14. * AUTHOR: M. Duncan
  15. * DATE WRITTEN: May 11, 1992.
  16. * REVISIONS: May 27 - corrected it for negative Q and use power
  17. * series for small Q.
  18. ***********************************************************************
  19. real*8 function orbel_zget(q)
  20. include '../swift.inc'
  21. c... Inputs Only:
  22. real*8 q
  23. c... Internals:
  24. integer iflag
  25. real*8 x,tmp
  26. c----
  27. c... Executable code
  28. iflag = 0
  29. if(q.lt.0.d0) then
  30. iflag = 1
  31. q = -q
  32. endif
  33. if (q.lt.1.d-3) then
  34. orbel_zget = q*(1.d0 - (q*q/3.d0)*(1.d0 -q*q))
  35. else
  36. x = 0.5d0*(3.d0*q + sqrt(9.d0*(q**2) +4.d0))
  37. tmp = x**(1.d0/3.d0)
  38. orbel_zget = tmp - 1.d0/tmp
  39. endif
  40. if(iflag .eq.1) then
  41. orbel_zget = -orbel_zget
  42. q = -q
  43. endif
  44. return
  45. end ! orbel_zget
  46. c----------------------------------------------------------------------