real*8 function ut2carr(ut) ! ! Given Universal Time ut (Julian Day Number & fraction), returns ! the Carrington solar rotation number (& fraction). ! ! B. Knapp, 2001-01-10 ! ! Reference: J. Meeus, Astronomical Algorithms, 2nd ed., Willmann- ! Bell, 1998, pp. 191-192. ! C C RCS DATA C C $Header$ C C $Log$ C C implicit none ! ! Input real*8 ut ! ! Constants real*8 PI, D2R, TOL parameter (PI=3.14159265358979324D0,D2R=PI/180.0D0) parameter (TOL=1.d-8) ! ! Function parameters real*8 T0, dTdC, M0, dMdC, P, Q, R parameter (T0=2398140.2270d0, dTdC=27.2752316D0) parameter (M0=281.96d0*D2R, dMdC=26.882476d0*D2R) parameter (P=0.1454d0, Q=-0.0085d0, R=-0.0141d0) ! ! Local variables real*8 m, t, dT, c, cPrev, cosM, sinM, cos2M, sin2M ! ! External subroutines, functions real*8 ut2td external ut2td ! ! Get dynamic time t = ut2td(ut) ! ! Initialize dT = T0-t c = -dT/dTdC ! ! Iterate, using Newton's method cPrev = 0.d0 do while(abs(c-cPrev) .gt. TOL) m = M0+dMdC*c sinM = sin(m) cosM = cos(m) sin2M = sin(2.d0*m) cos2M = cos(2.d0*m) cPrev = c c = c - (dT+dTdC*c+P*sinM+Q*sin2M+R*cos2M)/ & (dTdC+(P*cosM+2.d0*Q*cos2M-2.d0*R*sin2M)*dMdC) enddo ut2carr = c return end