C+ C NAME: C MAP_TZERO C PURPOSE: C Calculate list of start times for subsequent 'Carrington rotations' C CATEGORY: C Celestial mechanics C CALLING SEQUENCE: subroutine MAP_TZERO(SC_NAME,iYr,Doy_IN,DELDOY,nCar,JDCar) C INPUTS: C SC_NAME real external function; identifies spacecraft C iYr integer year C Doy_IN real doy of year; including fraction for time of day C DELDOY real required accuracy (in days) for the Carrington C start times JDCar C nCar integer # start times to be calculated C OUTPUTS: C JDCar(nCar) double precision Carrington start times in Julian days C CALLS: C Julian, SC_NAME, Int2Str, Str2Str, Flt2Str, Dbl2Str, Say C PROCEDURE: C > SC_NAME must be declared EXTERNAL in the calling program unit. C SC_NAME is a user-written function which calculates the heliographic C longitude XLNG of a spacecraft for a given time iYr,Doy C The call to SC_NAME has the form: C XLNG = SC_NAME(iYr,Doy) C where iYr (integer*4) and Doy (real*4) are input and XLNG (real*4) C is output. C > iYr,Doy_IN is the time where the search for start times begins. C the first nCar Carrington start times after iYr,Doy_IN are calculated C > The spacecraft is supposed to move in the ecliptic, circling the Sun in C the same direction as Earth (direct motion) C > The start time of a new Carrington rotation is defined as the time for C which the heliographic longitude of the spacecraft is zero. C MODIFICATION HISTORY: C JAN-1992, Paul Hick (UCSD/CASS; pphick@ucsd.edu) C- real SC_NAME integer iYr real Doy_IN real DELDOY integer nCar double precision JDCar(*) double precision JEpoch character cStr*160 integer Str2Str integer Flt2Str integer Dbl2Str !------- ! Sidereal solar rotation period at lat 16 deg (days) ! (Does not have to be very accurate. Make sure to underestimate it.) ROT_SUN = 25.339 N = 0 DEL = 0.1*ROT_SUN Doy = Doy_IN-ROT_SUN !------- ! Collect nCar start times for subsequent Carrington rotations do while (N .lt. nCar) Doy1 = Doy+ROT_SUN XLNG1 = SC_NAME(iYr,Doy1) XLNG0 = XLNG1+1. !------- ! The spacecraft heliographic longitude is a decreasing function of time ! within one Carrington rotation (the Sun catches up with the spacecraft). ! ! Step forward in time from Doy1 with step size DEL until the heliographic ! longitude jumps from (almost) 0 at time Doy0 to (almost) 360 at time Doy1. do while (XLNG1 .lt. XLNG0) XLNG0 = XLNG1 Doy1 = Doy1+DEL XLNG1 = SC_NAME(iYr,Doy1) end do Doy0 = Doy1-DEL !------- ! A new Carrington rotation starts between Doy0 and Doy1. Refine the ! determination of the start time (until it is better than DELDOY) by repeated ! bisection on the interval [Doy0,Doy1] do while (Doy1-Doy0 .gt. DELDOY) Doy = 0.5*(Doy0+Doy1) XLNG = SC_NAME(iYr,Doy) if (XLNG .lt. XLNG0) then Doy0 = Doy XLNG0 = XLNG else Doy1 = Doy XLNG1 = XLNG end if end do !------ ! Take the center of the final interval [Doy0,Doy1] as the final estimate for ! the start time of a new Carrington rotation. ! The final start time is returned in Julian days JDCar(N). Doy = 0.5*(Doy0+Doy1) N = N+1 call Julian(0,iYr,Doy,JDCar(N),JEpoch) end do if (nCar .gt. 10) then call Julian(1, iYr1, Doy1, JDCar( 1), JEPoch) call Julian(1, iYr2, Doy2 ,JDCar(nCar), JEPoch) I = 0 I = I+Str2Str('Start yr',cStr(I+1:))+1 I = I+Int2Str(iYr1 ,cStr(I+1:)) I = I+Str2Str(', doy',cStr(I+1:))+1 I = I+Flt2Str(Doy1,3 ,cStr(I+1:)) I = I+Str2Str(' (JD' ,cStr(I+1:))+1 I = I+Dbl2Str(JDCar(1),1,cStr(I+1:)) I = I+Str2Str(')' ,cStr(I+1:)) call Say('MAP_TZERO','I','JDCar',cStr) I = 0 I = I+Str2Str(' End yr',cStr(I+1:))+1 I = I+Int2Str(iYr2 ,cStr(I+1:)) I = I+Str2Str(', doy',cStr(I+1:))+1 I = I+Flt2Str(Doy2,3 ,cStr(I+1:)) I = I+Str2Str(' (JD' ,cStr(I+1:))+1 I = I+Dbl2Str(JDCar(nCar),1,cStr(I+1:)) I = I+Str2Str(')' ,cStr(I+1:)) call Say('MAP_TZERO','I','JDCar',cStr) end if return end