orbel_esolmd.f 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. ***********************************************************************
  2. c ORBEL_ESOLMD.F
  3. ***********************************************************************
  4. * PURPOSE: Solves Kepler's eqn. e is ecc. m is mean anomaly.
  5. *
  6. * Input:
  7. * e ==> eccentricity anomaly. (real scalar)
  8. * m ==> mean anomaly. (real scalar)
  9. * Returns:
  10. * orbel_esolmd ==> eccentric anomaly. (real scalar)
  11. *
  12. * ALGORITHM: Some sort of quartic convergence from Wisdom.
  13. * REMARKS: ONLY GOOD FOR SMALL ECCENTRICITY SINCE IT ONLY
  14. * ITERATES ONCE. (GOOD FOR PLANET CALCS.)
  15. * ALSO DOES NOT PUT M OR E BETWEEN 0. AND 2*PI
  16. * INCLUDES: needs SCGET.F
  17. * AUTHOR: M. Duncan
  18. * DATE WRITTEN: May 7, 1992.
  19. * REVISIONS: 2/26/93 hfl
  20. ***********************************************************************
  21. real*8 function orbel_esolmd(e,m)
  22. include '../swift.inc'
  23. c... Inputs Only:
  24. real*8 e,m
  25. c... Internals:
  26. real*8 x,sm,cm,sx,cx
  27. real*8 es,ec,f,fp,fpp,fppp,dx
  28. c----
  29. c... Executable code
  30. c... Function to solve Kepler's eqn for E (here called
  31. c... x) for given e and M. returns value of x.
  32. call orbel_scget(m,sm,cm)
  33. x = m + e*sm*( 1.d0 + e*( cm + e*( 1.d0 -1.5d0*sm*sm)))
  34. call orbel_scget(x,sx,cx)
  35. es = e*sx
  36. ec = e*cx
  37. f = x - es - m
  38. fp = 1.d0 - ec
  39. fpp = es
  40. fppp = ec
  41. dx = -f/fp
  42. dx = -f/(fp + dx*fpp/2.d0)
  43. dx = -f/(fp + dx*fpp/2.d0 + dx*dx*fppp/6.d0)
  44. orbel_esolmd = x + dx
  45. return ! orbel_esolmd
  46. end
  47. c--------------------------------------------------------------------