source: Sophya/trunk/SophyaExt/XephemAstroLib/deltat.c@ 1895

Last change on this file since 1895 was 1719, checked in by cmv, 24 years ago

Adapted to version 3.5 xephem cmv 22/10/2001

File size: 10.3 KB
Line 
1/* DeltaT = Ephemeris Time - Universal Time
2 *
3 * original code by Stephen Moshier <moshier@world.std.com>,
4 * adapted to xephem by Michael Sternberg <sternberg@physik.tu-chemnitz.de>
5 * smoothed transitions and updated by Neal McBurnett <nealmcb@bell-labs.com>
6 *
7 **********************************************************************
8 *
9 * The tabulated values of deltaT, in hundredths of a second,
10 * were taken from The Astronomical Almanac, page K8. The program
11 * adjusts for a value of secular tidal acceleration ndot = -25.8
12 * arcsec per century squared, the value used in JPL's DE403 ephemeris.
13 * ELP2000 (and DE200) used the value -23.8946.
14 *
15 * The tabulated range is 1620.0 through 1998.0. Bessel's interpolation
16 * formula is implemented to obtain fourth order interpolated values at
17 * intermediate times.
18 *
19 * For dates earlier than the tabulated range, the program
20 * calculates approximate formulae of Stephenson and Morrison
21 * or K. M. Borkowski. These approximations have an estimated
22 * error of 15 minutes at 1500 B.C. They are not adjusted for small
23 * improvements in the current estimate of ndot because the formulas
24 * were derived from studies of ancient eclipses and other historical
25 * information, whose interpretation depends only partly on ndot.
26 *
27 * For future vaues of deltaT, the function smoothly transitions with
28 * a linear segment back to Stephenson & Morrison's quadratic formula
29 * in 2130.
30 *
31 * Input is mjd (modified julian date from MJD0 on). [stern]
32 * Note that xephem uses a different epoch for this "mjd" than the
33 * normal value of JD=240000.5.
34 * See AA page B4.
35 *
36 * Output double deltat(mjd) is ET-UT1 in seconds.
37 *
38 *
39 * References:
40 *
41 * Stephenson, F. R., and L. V. Morrison, "Long-term changes
42 * in the rotation of the Earth: 700 B.C. to A.D. 1980,"
43 * Philosophical Transactions of the Royal Society of London
44 * Series A 313, 47-70 (1984)
45 *
46 * Borkowski, K. M., "ELP2000-85 and the Dynamical Time
47 * - Universal Time relation," Astronomy and Astrophysics
48 * 205, L8-L10 (1988)
49 * Borkowski's formula is derived from eclipses going back to 2137 BC
50 * and uses lunar position based on tidal coefficient of -23.9 arcsec/cy^2.
51 *
52 * Chapront-Touze, Michelle, and Jean Chapront, _Lunar Tables
53 * and Programs from 4000 B.C. to A.D. 8000_, Willmann-Bell 1991
54 * Their table agrees with the one here, but the entries are
55 * rounded to the nearest whole second.
56 *
57 * Stephenson, F. R., and M. A. Houlden, _Atlas of Historical
58 * Eclipse Maps_, Cambridge U. Press (1986)
59 *
60 * from obsolete extrapolation code [stern]:
61 * Morrison, L. V. and F. R. Stephenson, "Sun and Planetary System"
62 * vol 96,73 eds. W. Fricke, G. Teleki, Reidel, Dordrecht (1982)
63 *
64 **********************************************************************
65 *
66 * changes by stern:
67 * - adopted #include's for xephem
68 * - made dt[] static
69 * - made mjd the time argument [was: year Y].
70 * - updated observed and extrapolated data from tables at
71 * ftp://maia.usno.navy.mil/ser7/ -- data deviated by up to 0.8 s
72 * - removed references to "extern double dtgiven"
73 * - removed DEMO #define and its references
74 * - replaced treatment after TABEND by linear extrapolation instead
75 * of second order version
76 * - installed lastmjd cache (made ans static)
77 *
78 * - no changes to table interpolation scheme and past extrapolations */
79
80#include "P_.h"
81#include "astro.h"
82
83#define TABSTART 1620.0
84#define TABEND 2006.0
85#define TABSIZ 387
86
87/* Note, Stephenson and Morrison's table starts at the year 1630.
88 * The Chapronts' table does not agree with the Almanac prior to 1630.
89 * The actual accuracy decreases rapidly prior to 1780.
90 */
91static short dt[TABSIZ] = {
92 /* 1620.0 thru 1659.0 */
93 12400, 11900, 11500, 11000, 10600, 10200, 9800, 9500, 9100, 8800,
94 8500, 8200, 7900, 7700, 7400, 7200, 7000, 6700, 6500, 6300,
95 6200, 6000, 5800, 5700, 5500, 5400, 5300, 5100, 5000, 4900,
96 4800, 4700, 4600, 4500, 4400, 4300, 4200, 4100, 4000, 3800,
97 /* 1660.0 thru 1699.0 */
98 3700, 3600, 3500, 3400, 3300, 3200, 3100, 3000, 2800, 2700,
99 2600, 2500, 2400, 2300, 2200, 2100, 2000, 1900, 1800, 1700,
100 1600, 1500, 1400, 1400, 1300, 1200, 1200, 1100, 1100, 1000,
101 1000, 1000, 900, 900, 900, 900, 900, 900, 900, 900,
102 /* 1700.0 thru 1739.0 */
103 900, 900, 900, 900, 900, 900, 900, 900, 1000, 1000,
104 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1100, 1100, 1100,
105 1100, 1100, 1100, 1100, 1100, 1100, 1100, 1100, 1100, 1100,
106 1100, 1100, 1100, 1100, 1200, 1200, 1200, 1200, 1200, 1200,
107 /* 1740.0 thru 1779.0 */
108 1200, 1200, 1200, 1200, 1300, 1300, 1300, 1300, 1300, 1300,
109 1300, 1400, 1400, 1400, 1400, 1400, 1400, 1400, 1500, 1500,
110 1500, 1500, 1500, 1500, 1500, 1600, 1600, 1600, 1600, 1600,
111 1600, 1600, 1600, 1600, 1600, 1700, 1700, 1700, 1700, 1700,
112 /* 1780.0 thru 1799.0 */
113 1700, 1700, 1700, 1700, 1700, 1700, 1700, 1700, 1700, 1700,
114 1700, 1700, 1600, 1600, 1600, 1600, 1500, 1500, 1400, 1400,
115 /* 1800.0 thru 1819.0 */
116 1370, 1340, 1310, 1290, 1270, 1260, 1250, 1250, 1250, 1250,
117 1250, 1250, 1250, 1250, 1250, 1250, 1250, 1240, 1230, 1220,
118 /* 1820.0 thru 1859.0 */
119 1200, 1170, 1140, 1110, 1060, 1020, 960, 910, 860, 800,
120 750, 700, 660, 630, 600, 580, 570, 560, 560, 560,
121 570, 580, 590, 610, 620, 630, 650, 660, 680, 690,
122 710, 720, 730, 740, 750, 760, 770, 770, 780, 780,
123 /* 1860.0 thru 1899.0 */
124 788, 782, 754, 697, 640, 602, 541, 410, 292, 182,
125 161, 10, -102, -128, -269, -324, -364, -454, -471, -511,
126 -540, -542, -520, -546, -546, -579, -563, -564, -580, -566,
127 -587, -601, -619, -664, -644, -647, -609, -576, -466, -374,
128 /* 1900.0 thru 1939.0 */
129 -272, -154, -2, 124, 264, 386, 537, 614, 775, 913,
130 1046, 1153, 1336, 1465, 1601, 1720, 1824, 1906, 2025, 2095,
131 2116, 2225, 2241, 2303, 2349, 2362, 2386, 2449, 2434, 2408,
132 2402, 2400, 2387, 2395, 2386, 2393, 2373, 2392, 2396, 2402,
133 /* 1940.0 thru 1979.0 */
134 2433, 2483, 2530, 2570, 2624, 2677, 2728, 2778, 2825, 2871,
135 2915, 2957, 2997, 3036, 3072, 3107, 3135, 3168, 3218, 3268,
136 3315, 3359, 3400, 3447, 3503, 3573, 3654, 3743, 3829, 3920,
137 4018, 4117, 4223, 4337, 4449, 4548, 4646, 4752, 4853, 4959,
138 /* 1980.0 thru 1995.0 */
139 5054, 5138, 5217, 5296, 5379, 5434, 5487, 5532, 5582, 5630,
140 5686, 5757, 5831, 5912, 5998, 6078,
141 /* new USNO data (stern) */
142 6163, 6230,
143 /* 1999 USNO data 1998.0 thru 2000.0 (McBurnett) */
144 6297, 6347, 6383,
145 /* 1999 extrapolation (McBurnett), 2001.0 thru 2006.0
146 Ramp up to 1.6 s/yr to transition smoothly to Stevenson formula
147 in 2130.0 */
148 6440, 6510, 6600, 6750, 6900, 7060
149
150 /* original 1997 USNO extrapolation (stern), 1998.0 thru 2004.0
151 6296, 6420,
152 6510, 6600, 6700, 6800, 6900 */ /* 7000, 7100, 7200, 7300, 7400, */
153
154 /* Extrapolated values (USNO) (original Moshier) [1996.0 thru 2005.0]
155 6183, 6280, 6377, 6475,
156 6572, 6667, 6765, 6861, 6957
157 */
158};
159
160/* calculate DeltaT = ET - UT1 in seconds. Describes the irregularities
161 * of the Earth rotation rate in the ET time scale.
162 */
163double deltat(mjd)
164double mjd;
165{
166 double Y;
167 double p, B;
168 int d[6];
169 int i, iy, k;
170 double floor();
171 static double ans;
172 static double lastmjd = -10000;
173
174 if (mjd == lastmjd) {
175 return(ans);
176 }
177 lastmjd = mjd;
178
179 Y = 2000.0 + (mjd - J2000)/365.25;
180
181 if( Y > TABEND && Y < 2130.0 ) {
182 /* linear interpolation from table end; stern */
183 B = Y - TABEND;
184 ans = dt[TABSIZ-1] + B * (dt[TABSIZ-1] - dt[TABSIZ-2]);
185 ans *= 0.01;
186 return(ans);
187 }
188
189 if( Y < TABSTART || Y >= 2130.0 ) {
190 if( (Y >= 948.0 - 15.0 && Y < TABSTART) || Y >= 2130.0 ) {
191 /* Stephenson and Morrison, stated domain is 948 to 1600:
192 * 25.5(centuries from 1800)^2 - 1.9159(centuries from 1955)^2
193 * Here we offset by -15 y to minimize the discontinuity,
194 * thus we use it from 933.0 to 1620.0,
195 * and from the end of the table to 2130.0.
196 * f(1620.0) = 60.955200, slope -0.079 s/y
197 * f(2004.0) = 105.649728, slope 1.02 s/y
198 * f(2048.0) = 155.176, slope 1.23 s/y
199 * f(2084.0) = 202.49, slope 1.4 s/y
200 * f(2130.0) = 272, slope .1616
201 * f(2150.0) = 305, slope .17
202 */
203 B = 0.01*(Y - 2000.0);
204 ans = (23.58 * B + 100.3)*B + 101.6;
205 } else {
206 /* Borkowski */
207 /* f(2004.0) = 542.7435, slope 2.65 s/y */
208 B = 0.01*(Y - 2000.0) + 3.75;
209 ans = 35.0 * B * B + 40.;
210 }
211 return(ans);
212 }
213
214 /* Besselian interpolation from tabulated values.
215 * See AA page K11.
216 */
217
218 /* value for 1620.1 is 121.96 or so, not 124.0 */
219
220 /* Index into the table.
221 */
222 p = floor(Y);
223 iy = (int)(p - TABSTART);
224 /* Zeroth order estimate is value at start of year
225 */
226 ans = dt[iy];
227 k = iy + 1;
228 if( k >= TABSIZ )
229 goto done; /* No data, can't go on. */
230
231 /* The fraction of tabulation interval
232 */
233 p = Y - p;
234
235 /* First order interpolated value
236 */
237 ans += p*(dt[k] - dt[iy]);
238 if( (iy-1 < 0) || (iy+2 >= TABSIZ) )
239 goto done; /* can't do second differences */
240
241 /* Make table of first differences
242 */
243 k = iy - 2;
244 for( i=0; i<5; i++ ) {
245 if( (k < 0) || (k+1 >= TABSIZ) )
246 d[i] = 0;
247 else d[i] = dt[k+1] - dt[k];
248 k += 1;
249 }
250
251 /* Compute second differences
252 */
253 for( i=0; i<4; i++ )
254 d[i] = d[i+1] - d[i];
255 B = 0.25*p*(p-1.0);
256 ans += B*(d[1] + d[2]);
257 if( iy+2 >= TABSIZ )
258 goto done;
259
260 /* Compute third differences
261 */
262 for( i=0; i<3; i++ )
263 d[i] = d[i+1] - d[i];
264 B = 2.0*B/3.0;
265 ans += (p-0.5)*B*d[1];
266 if( (iy-2 < 0) || (iy+3 > TABSIZ) )
267 goto done;
268
269 /* Compute fourth differences
270 */
271 for( i=0; i<2; i++ )
272 d[i] = d[i+1] - d[i];
273 B = 0.125*B*(p+1.0)*(p-2.0);
274 ans += B*(d[0] + d[1]);
275
276 done:
277 /* Astronomical Almanac table is corrected by adding the expression
278 * -0.000091 (ndot + 26)(year-1955)^2 seconds
279 * to entries prior to 1955 (AA page K8), where ndot is the secular
280 * tidal term in the mean motion of the Moon.
281 *
282 * Entries after 1955 are referred to atomic time standards and
283 * are not affected by errors in Lunar or planetary theory.
284 */
285 ans *= 0.01;
286 if( Y < 1955.0 ) {
287 B = (Y - 1955.0);
288 ans += -0.000091 * (-25.8 + 26.0) * B * B;
289 }
290 return( ans );
291}
292
293
294#ifdef TEST_DT
295main()
296{
297 double ans, y;
298
299 while (scanf("%lf", &y) == 1) {
300 ans = deltat((y - 2000.0)*365.25 + J2000);
301 printf("%.4lf %.4lf\n", y, ans);
302 }
303}
304#endif
305
306/* For RCS Only -- Do Not Edit */
307static char *rcsid[2] = {(char *)rcsid, "@(#) $RCSfile: deltat.c,v $ $Date: 2001-10-22 12:08:26 $ $Revision: 1.2 $ $Name: not supported by cvs2svn $"};
Note: See TracBrowser for help on using the repository browser.