123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109 |
- ***********************************************************************
- c ORBEL_FLON.F
- ***********************************************************************
- * PURPOSE: Solves Kepler's eqn. for hyperbola using hybrid approach.
- *
- * Input:
- * e ==> eccentricity anomaly. (real scalar)
- * capn ==> hyperbola mean anomaly. (real scalar)
- * Returns:
- * orbel_flon ==> eccentric anomaly. (real scalar)
- *
- * ALGORITHM: Uses power series for N in terms of F and Newton,s method
- * REMARKS: ONLY GOOD FOR LOW VALUES OF N (N < 0.636*e -0.6)
- * AUTHOR: M. Duncan
- * DATE WRITTEN: May 26, 1992.
- * REVISIONS:
- ***********************************************************************
- real*8 function orbel_flon(e,capn)
- include '../swift.inc'
- c... Inputs Only:
- real*8 e,capn
- c... Internals:
- integer iflag,i,IMAX
- real*8 a,b,sq,biga,bigb
- real*8 x,x2
- real*8 f,fp,dx
- real*8 diff
- real*8 a0,a1,a3,a5,a7,a9,a11
- real*8 b1,b3,b5,b7,b9,b11
- PARAMETER (IMAX = 10)
- PARAMETER (a11 = 156.d0,a9 = 17160.d0,a7 = 1235520.d0)
- PARAMETER (a5 = 51891840.d0,a3 = 1037836800.d0)
- PARAMETER (b11 = 11.d0*a11,b9 = 9.d0*a9,b7 = 7.d0*a7)
- PARAMETER (b5 = 5.d0*a5, b3 = 3.d0*a3)
- c----
- c... Executable code
- c Function to solve "Kepler's eqn" for F (here called
- c x) for given e and CAPN. Only good for smallish CAPN
- iflag = 0
- if( capn .lt. 0.d0) then
- iflag = 1
- capn = -capn
- endif
- a1 = 6227020800.d0 * (1.d0 - 1.d0/e)
- a0 = -6227020800.d0*capn/e
- b1 = a1
- c Set iflag nonzero if capn < 0., in which case solve for -capn
- c and change the sign of the final answer for F.
- c Begin with a reasonable guess based on solving the cubic for small F
- a = 6.d0*(e-1.d0)/e
- b = -6.d0*capn/e
- sq = sqrt(0.25*b*b +a*a*a/27.d0)
- biga = (-0.5*b + sq)**0.3333333333333333d0
- bigb = -(+0.5*b + sq)**0.3333333333333333d0
- x = biga + bigb
- c write(6,*) 'cubic = ',x**3 +a*x +b
- orbel_flon = x
- c If capn is tiny (or zero) no need to go further than cubic even for
- c e =1.
- if( capn .lt. TINY) go to 100
- do i = 1,IMAX
- x2 = x*x
- f = a0 +x*(a1+x2*(a3+x2*(a5+x2*(a7+x2*(a9+x2*(a11+x2))))))
- fp = b1 +x2*(b3+x2*(b5+x2*(b7+x2*(b9+x2*(b11 + 13.d0*x2)))))
- dx = -f/fp
- c write(6,*) 'i,dx,x,f : '
- c write(6,432) i,dx,x,f
- 432 format(1x,i3,3(2x,1p1e22.15))
- orbel_flon = x + dx
- c If we have converged here there's no point in going on
- if(abs(dx) .le. TINY) go to 100
- x = orbel_flon
- enddo
- c Abnormal return here - we've gone thru the loop
- c IMAX times without convergence
- if(iflag .eq. 1) then
- orbel_flon = -orbel_flon
- capn = -capn
- endif
- write(6,*) 'FLON : RETURNING WITHOUT COMPLETE CONVERGENCE'
- diff = e*sinh(orbel_flon) - orbel_flon - capn
- write(6,*) 'N, F, ecc*sinh(F) - F - N : '
- write(6,*) capn,orbel_flon,diff
- return
- c Normal return here, but check if capn was originally negative
- 100 if(iflag .eq. 1) then
- orbel_flon = -orbel_flon
- capn = -capn
- endif
- return
- end ! orbel_flon
- c------------------------------------------------------------------
|