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

Last change on this file since 3660 was 3654, checked in by cmv, 16 years ago

mise a niveau Xephem 3.7.4, cmv 16/07/2009

File size: 10.0 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 mj (modified julian date from MJD0 on). [stern]
32 * Note that xephem uses a different epoch for this "mj" than the
33 * normal value of JD=240000.5.
34 * See AA page B4.
35 *
36 * Output double deltat(mj) 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 mj 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 lastmj cache (made ans static)
77 *
78 * - no changes to table interpolation scheme and past extrapolations */
79
80#include <math.h>
81
82#include "astro.h"
83
84#define TABSTART 1620.0
85#define TABEND 2017.0
86#define TABSIZ 398
87
88/* Note, Stephenson and Morrison's table starts at the year 1630.
89 * The Chapronts' table does not agree with the Almanac prior to 1630.
90 * The actual accuracy decreases rapidly prior to 1780.
91 */
92static short dt[TABSIZ] = {
93 /* 1620.0 thru 1659.0 */
94 12400, 11900, 11500, 11000, 10600, 10200, 9800, 9500, 9100, 8800,
95 8500, 8200, 7900, 7700, 7400, 7200, 7000, 6700, 6500, 6300,
96 6200, 6000, 5800, 5700, 5500, 5400, 5300, 5100, 5000, 4900,
97 4800, 4700, 4600, 4500, 4400, 4300, 4200, 4100, 4000, 3800,
98 /* 1660.0 thru 1699.0 */
99 3700, 3600, 3500, 3400, 3300, 3200, 3100, 3000, 2800, 2700,
100 2600, 2500, 2400, 2300, 2200, 2100, 2000, 1900, 1800, 1700,
101 1600, 1500, 1400, 1400, 1300, 1200, 1200, 1100, 1100, 1000,
102 1000, 1000, 900, 900, 900, 900, 900, 900, 900, 900,
103 /* 1700.0 thru 1739.0 */
104 900, 900, 900, 900, 900, 900, 900, 900, 1000, 1000,
105 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1100, 1100, 1100,
106 1100, 1100, 1100, 1100, 1100, 1100, 1100, 1100, 1100, 1100,
107 1100, 1100, 1100, 1100, 1200, 1200, 1200, 1200, 1200, 1200,
108 /* 1740.0 thru 1779.0 */
109 1200, 1200, 1200, 1200, 1300, 1300, 1300, 1300, 1300, 1300,
110 1300, 1400, 1400, 1400, 1400, 1400, 1400, 1400, 1500, 1500,
111 1500, 1500, 1500, 1500, 1500, 1600, 1600, 1600, 1600, 1600,
112 1600, 1600, 1600, 1600, 1600, 1700, 1700, 1700, 1700, 1700,
113 /* 1780.0 thru 1799.0 */
114 1700, 1700, 1700, 1700, 1700, 1700, 1700, 1700, 1700, 1700,
115 1700, 1700, 1600, 1600, 1600, 1600, 1500, 1500, 1400, 1400,
116 /* 1800.0 thru 1819.0 */
117 1370, 1340, 1310, 1290, 1270, 1260, 1250, 1250, 1250, 1250,
118 1250, 1250, 1250, 1250, 1250, 1250, 1250, 1240, 1230, 1220,
119 /* 1820.0 thru 1859.0 */
120 1200, 1170, 1140, 1110, 1060, 1020, 960, 910, 860, 800,
121 750, 700, 660, 630, 600, 580, 570, 560, 560, 560,
122 570, 580, 590, 610, 620, 630, 650, 660, 680, 690,
123 710, 720, 730, 740, 750, 760, 770, 770, 780, 780,
124 /* 1860.0 thru 1899.0 */
125 788, 782, 754, 697, 640, 602, 541, 410, 292, 182,
126 161, 10, -102, -128, -269, -324, -364, -454, -471, -511,
127 -540, -542, -520, -546, -546, -579, -563, -564, -580, -566,
128 -587, -601, -619, -664, -644, -647, -609, -576, -466, -374,
129 /* 1900.0 thru 1939.0 */
130 -272, -154, -2, 124, 264, 386, 537, 614, 775, 913,
131 1046, 1153, 1336, 1465, 1601, 1720, 1824, 1906, 2025, 2095,
132 2116, 2225, 2241, 2303, 2349, 2362, 2386, 2449, 2434, 2408,
133 2402, 2400, 2387, 2395, 2386, 2393, 2373, 2392, 2396, 2402,
134 /* 1940.0 thru 1979.0 */
135 2433, 2483, 2530, 2570, 2624, 2677, 2728, 2778, 2825, 2871,
136 2915, 2957, 2997, 3036, 3072, 3107, 3135, 3168, 3218, 3268,
137 3315, 3359, 3400, 3447, 3503, 3573, 3654, 3743, 3829, 3920,
138 4018, 4117, 4223, 4337, 4449, 4548, 4646, 4752, 4853, 4959,
139 /* 1980.0 thru 1995.0 */
140 5054, 5138, 5217, 5296, 5379, 5434, 5487, 5532, 5582, 5630,
141 5686, 5757, 5831, 5912, 5998, 6078,
142 /* new USNO data (stern) */
143 6163, 6230,
144 /* 1999 USNO data 1998.0 thru 2000.0 (McBurnett) */
145 6297, 6347, 6383,
146
147 6409, 6430, 6447, 6507, 6546, 6546, 6546,
148
149 /* 2008+ added 5/19/2009 from http://maia.usno.navy.mil/ser7/deltat.preds */
150
151 6546,
152 6570,
153 6650,
154 6710,
155 6800,
156 6800,
157 6900,
158 6900,
159 7000,
160 7000,
161};
162
163/* calculate DeltaT = ET - UT1 in seconds. Describes the irregularities
164 * of the Earth rotation rate in the ET time scale.
165 */
166double deltat(double mj)
167{
168 double Y;
169 double p, B;
170 int d[6];
171 int i, iy, k;
172 static double ans;
173 static double lastmj = -10000;
174
175 if (mj == lastmj) {
176 return(ans);
177 }
178 lastmj = mj;
179
180 Y = 2000.0 + (mj - J2000)/365.25;
181
182 if( Y > TABEND) {
183 /* linear interpolation from table end; stern */
184 B = Y - TABEND;
185 ans = dt[TABSIZ-1] + B * (dt[TABSIZ-1] - dt[TABSIZ-11])/10;
186 ans *= 0.01;
187 return(ans);
188 }
189
190 if( Y < TABSTART) {
191 if( Y >= 948.0 - 15.0 ) {
192 /* Stephenson and Morrison, stated domain is 948 to 1600:
193 * 25.5(centuries from 1800)^2 - 1.9159(centuries from 1955)^2
194 * Here we offset by -15 y to minimize the discontinuity,
195 * thus we use it from 933.0 to 1620.0,
196 * and from the end of the table to 2130.0.
197 * f(1620.0) = 60.955200, slope -0.079 s/y
198 * f(2004.0) = 105.649728, slope 1.02 s/y
199 * f(2048.0) = 155.176, slope 1.23 s/y
200 * f(2084.0) = 202.49, slope 1.4 s/y
201 * f(2130.0) = 272, slope .1616
202 * f(2150.0) = 305, slope .17
203 */
204 B = 0.01*(Y - 2000.0);
205 ans = (23.58 * B + 100.3)*B + 101.6;
206 } else {
207 /* Borkowski */
208 /* f(2004.0) = 542.7435, slope 2.65 s/y */
209 B = 0.01*(Y - 2000.0) + 3.75;
210 ans = 35.0 * B * B + 40.;
211 }
212 return(ans);
213 }
214
215 /* Besselian interpolation from tabulated values.
216 * See AA page K11.
217 */
218
219 /* value for 1620.1 is 121.96 or so, not 124.0 */
220
221 /* Index into the table.
222 */
223 p = floor(Y);
224 iy = (int)(p - TABSTART);
225 /* Zeroth order estimate is value at start of year
226 */
227 ans = dt[iy];
228 k = iy + 1;
229 if( k >= TABSIZ )
230 goto done; /* No data, can't go on. */
231
232 /* The fraction of tabulation interval
233 */
234 p = Y - p;
235
236 /* First order interpolated value
237 */
238 ans += p*(dt[k] - dt[iy]);
239 if( (iy-1 < 0) || (iy+2 >= TABSIZ) )
240 goto done; /* can't do second differences */
241
242 /* Make table of first differences
243 */
244 k = iy - 2;
245 for( i=0; i<5; i++ ) {
246 if( (k < 0) || (k+1 >= TABSIZ) )
247 d[i] = 0;
248 else d[i] = dt[k+1] - dt[k];
249 k += 1;
250 }
251
252 /* Compute second differences
253 */
254 for( i=0; i<4; i++ )
255 d[i] = d[i+1] - d[i];
256 B = 0.25*p*(p-1.0);
257 ans += B*(d[1] + d[2]);
258 if( iy+2 >= TABSIZ )
259 goto done;
260
261 /* Compute third differences
262 */
263 for( i=0; i<3; i++ )
264 d[i] = d[i+1] - d[i];
265 B = 2.0*B/3.0;
266 ans += (p-0.5)*B*d[1];
267 if( (iy-2 < 0) || (iy+3 > TABSIZ) )
268 goto done;
269
270 /* Compute fourth differences
271 */
272 for( i=0; i<2; i++ )
273 d[i] = d[i+1] - d[i];
274 B = 0.125*B*(p+1.0)*(p-2.0);
275 ans += B*(d[0] + d[1]);
276
277 done:
278 /* Astronomical Almanac table is corrected by adding the expression
279 * -0.000091 (ndot + 26)(year-1955)^2 seconds
280 * to entries prior to 1955 (AA page K8), where ndot is the secular
281 * tidal term in the mean motion of the Moon.
282 *
283 * Entries after 1955 are referred to atomic time standards and
284 * are not affected by errors in Lunar or planetary theory.
285 */
286 ans *= 0.01;
287 if( Y < 1955.0 ) {
288 B = (Y - 1955.0);
289 ans += -0.000091 * (-25.8 + 26.0) * B * B;
290 }
291 return( ans );
292}
293
294
295#ifdef TEST_DT
296main()
297{
298 double ans, y;
299
300 while (scanf("%lf", &y) == 1) {
301 ans = deltat((y - 2000.0)*365.25 + J2000);
302 printf("%.4lf %.4lf\n", y, ans);
303 }
304}
305#endif
306
307/* For RCS Only -- Do Not Edit */
308static char *rcsid[2] = {(char *)rcsid, "@(#) $RCSfile: deltat.c,v $ $Date: 2009-07-16 10:34:37 $ $Revision: 1.8 $ $Name: not supported by cvs2svn $"};
Note: See TracBrowser for help on using the repository browser.