orbel_fget.f 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  1. ***********************************************************************
  2. c ORBEL_FGET.F
  3. ***********************************************************************
  4. * PURPOSE: Solves Kepler's eqn. for hyperbola using hybrid approach.
  5. *
  6. * Input:
  7. * e ==> eccentricity anomaly. (real scalar)
  8. * capn ==> hyperbola mean anomaly. (real scalar)
  9. * Returns:
  10. * orbel_fget ==> eccentric anomaly. (real scalar)
  11. *
  12. * ALGORITHM: Based on pp. 70-72 of Fitzpatrick's book "Principles of
  13. * Cel. Mech. ". Quartic convergence from Danby's book.
  14. * REMARKS:
  15. * AUTHOR: M. Duncan
  16. * DATE WRITTEN: May 11, 1992.
  17. * REVISIONS: 2/26/93 hfl
  18. ***********************************************************************
  19. real*8 function orbel_fget(e,capn)
  20. include '../swift.inc'
  21. c... Inputs Only:
  22. real*8 e,capn
  23. c... Internals:
  24. integer i,IMAX
  25. real*8 tmp,x,shx,chx
  26. real*8 esh,ech,f,fp,fpp,fppp,dx
  27. PARAMETER (IMAX = 10)
  28. c----
  29. c... Executable code
  30. c Function to solve "Kepler's eqn" for F (here called
  31. c x) for given e and CAPN.
  32. c begin with a guess proposed by Danby
  33. if( capn .lt. 0.d0) then
  34. tmp = -2.d0*capn/e + 1.8d0
  35. x = -log(tmp)
  36. else
  37. tmp = +2.d0*capn/e + 1.8d0
  38. x = log( tmp)
  39. endif
  40. orbel_fget = x
  41. do i = 1,IMAX
  42. call orbel_schget(x,shx,chx)
  43. esh = e*shx
  44. ech = e*chx
  45. f = esh - x - capn
  46. c write(6,*) 'i,x,f : ',i,x,f
  47. fp = ech - 1.d0
  48. fpp = esh
  49. fppp = ech
  50. dx = -f/fp
  51. dx = -f/(fp + dx*fpp/2.d0)
  52. dx = -f/(fp + dx*fpp/2.d0 + dx*dx*fppp/6.d0)
  53. orbel_fget = x + dx
  54. c If we have converged here there's no point in going on
  55. if(abs(dx) .le. TINY) RETURN
  56. x = orbel_fget
  57. enddo
  58. write(6,*) 'FGET : RETURNING WITHOUT COMPLETE CONVERGENCE'
  59. return
  60. end ! orbel_fget
  61. c------------------------------------------------------------------