1 | #include "erfa.h"
|
---|
2 |
|
---|
3 | double eraEect00(double date1, double date2)
|
---|
4 | /*
|
---|
5 | ** - - - - - - - - - -
|
---|
6 | ** e r a E e c t 0 0
|
---|
7 | ** - - - - - - - - - -
|
---|
8 | **
|
---|
9 | ** Equation of the equinoxes complementary terms, consistent with
|
---|
10 | ** IAU 2000 resolutions.
|
---|
11 | **
|
---|
12 | ** Given:
|
---|
13 | ** date1,date2 double TT as a 2-part Julian Date (Note 1)
|
---|
14 | **
|
---|
15 | ** Returned (function value):
|
---|
16 | ** double complementary terms (Note 2)
|
---|
17 | **
|
---|
18 | ** Notes:
|
---|
19 | **
|
---|
20 | ** 1) The TT date date1+date2 is a Julian Date, apportioned in any
|
---|
21 | ** convenient way between the two arguments. For example,
|
---|
22 | ** JD(TT)=2450123.7 could be expressed in any of these ways,
|
---|
23 | ** among others:
|
---|
24 | **
|
---|
25 | ** date1 date2
|
---|
26 | **
|
---|
27 | ** 2450123.7 0.0 (JD method)
|
---|
28 | ** 2451545.0 -1421.3 (J2000 method)
|
---|
29 | ** 2400000.5 50123.2 (MJD method)
|
---|
30 | ** 2450123.5 0.2 (date & time method)
|
---|
31 | **
|
---|
32 | ** The JD method is the most natural and convenient to use in
|
---|
33 | ** cases where the loss of several decimal digits of resolution
|
---|
34 | ** is acceptable. The J2000 method is best matched to the way
|
---|
35 | ** the argument is handled internally and will deliver the
|
---|
36 | ** optimum resolution. The MJD method and the date & time methods
|
---|
37 | ** are both good compromises between resolution and convenience.
|
---|
38 | **
|
---|
39 | ** 2) The "complementary terms" are part of the equation of the
|
---|
40 | ** equinoxes (EE), classically the difference between apparent and
|
---|
41 | ** mean Sidereal Time:
|
---|
42 | **
|
---|
43 | ** GAST = GMST + EE
|
---|
44 | **
|
---|
45 | ** with:
|
---|
46 | **
|
---|
47 | ** EE = dpsi * cos(eps)
|
---|
48 | **
|
---|
49 | ** where dpsi is the nutation in longitude and eps is the obliquity
|
---|
50 | ** of date. However, if the rotation of the Earth were constant in
|
---|
51 | ** an inertial frame the classical formulation would lead to
|
---|
52 | ** apparent irregularities in the UT1 timescale traceable to side-
|
---|
53 | ** effects of precession-nutation. In order to eliminate these
|
---|
54 | ** effects from UT1, "complementary terms" were introduced in 1994
|
---|
55 | ** (IAU, 1994) and took effect from 1997 (Capitaine and Gontier,
|
---|
56 | ** 1993):
|
---|
57 | **
|
---|
58 | ** GAST = GMST + CT + EE
|
---|
59 | **
|
---|
60 | ** By convention, the complementary terms are included as part of
|
---|
61 | ** the equation of the equinoxes rather than as part of the mean
|
---|
62 | ** Sidereal Time. This slightly compromises the "geometrical"
|
---|
63 | ** interpretation of mean sidereal time but is otherwise
|
---|
64 | ** inconsequential.
|
---|
65 | **
|
---|
66 | ** The present function computes CT in the above expression,
|
---|
67 | ** compatible with IAU 2000 resolutions (Capitaine et al., 2002, and
|
---|
68 | ** IERS Conventions 2003).
|
---|
69 | **
|
---|
70 | ** Called:
|
---|
71 | ** eraFal03 mean anomaly of the Moon
|
---|
72 | ** eraFalp03 mean anomaly of the Sun
|
---|
73 | ** eraFaf03 mean argument of the latitude of the Moon
|
---|
74 | ** eraFad03 mean elongation of the Moon from the Sun
|
---|
75 | ** eraFaom03 mean longitude of the Moon's ascending node
|
---|
76 | ** eraFave03 mean longitude of Venus
|
---|
77 | ** eraFae03 mean longitude of Earth
|
---|
78 | ** eraFapa03 general accumulated precession in longitude
|
---|
79 | **
|
---|
80 | ** References:
|
---|
81 | **
|
---|
82 | ** Capitaine, N. & Gontier, A.-M., Astron. Astrophys., 275,
|
---|
83 | ** 645-650 (1993)
|
---|
84 | **
|
---|
85 | ** Capitaine, N., Wallace, P.T. and McCarthy, D.D., "Expressions to
|
---|
86 | ** implement the IAU 2000 definition of UT1", Astronomy &
|
---|
87 | ** Astrophysics, 406, 1135-1149 (2003)
|
---|
88 | **
|
---|
89 | ** IAU Resolution C7, Recommendation 3 (1994)
|
---|
90 | **
|
---|
91 | ** McCarthy, D. D., Petit, G. (eds.), IERS Conventions (2003),
|
---|
92 | ** IERS Technical Note No. 32, BKG (2004)
|
---|
93 | **
|
---|
94 | ** Copyright (C) 2013-2016, NumFOCUS Foundation.
|
---|
95 | ** Derived, with permission, from the SOFA library. See notes at end of file.
|
---|
96 | */
|
---|
97 | {
|
---|
98 | /* Time since J2000.0, in Julian centuries */
|
---|
99 | double t;
|
---|
100 |
|
---|
101 | /* Miscellaneous */
|
---|
102 | int i, j;
|
---|
103 | double a, s0, s1;
|
---|
104 |
|
---|
105 | /* Fundamental arguments */
|
---|
106 | double fa[14];
|
---|
107 |
|
---|
108 | /* Returned value. */
|
---|
109 | double eect;
|
---|
110 |
|
---|
111 | /* ----------------------------------------- */
|
---|
112 | /* The series for the EE complementary terms */
|
---|
113 | /* ----------------------------------------- */
|
---|
114 |
|
---|
115 | typedef struct {
|
---|
116 | int nfa[8]; /* coefficients of l,l',F,D,Om,LVe,LE,pA */
|
---|
117 | double s, c; /* sine and cosine coefficients */
|
---|
118 | } TERM;
|
---|
119 |
|
---|
120 | /* Terms of order t^0 */
|
---|
121 | static const TERM e0[] = {
|
---|
122 |
|
---|
123 | /* 1-10 */
|
---|
124 | {{ 0, 0, 0, 0, 1, 0, 0, 0}, 2640.96e-6, -0.39e-6 },
|
---|
125 | {{ 0, 0, 0, 0, 2, 0, 0, 0}, 63.52e-6, -0.02e-6 },
|
---|
126 | {{ 0, 0, 2, -2, 3, 0, 0, 0}, 11.75e-6, 0.01e-6 },
|
---|
127 | {{ 0, 0, 2, -2, 1, 0, 0, 0}, 11.21e-6, 0.01e-6 },
|
---|
128 | {{ 0, 0, 2, -2, 2, 0, 0, 0}, -4.55e-6, 0.00e-6 },
|
---|
129 | {{ 0, 0, 2, 0, 3, 0, 0, 0}, 2.02e-6, 0.00e-6 },
|
---|
130 | {{ 0, 0, 2, 0, 1, 0, 0, 0}, 1.98e-6, 0.00e-6 },
|
---|
131 | {{ 0, 0, 0, 0, 3, 0, 0, 0}, -1.72e-6, 0.00e-6 },
|
---|
132 | {{ 0, 1, 0, 0, 1, 0, 0, 0}, -1.41e-6, -0.01e-6 },
|
---|
133 | {{ 0, 1, 0, 0, -1, 0, 0, 0}, -1.26e-6, -0.01e-6 },
|
---|
134 |
|
---|
135 | /* 11-20 */
|
---|
136 | {{ 1, 0, 0, 0, -1, 0, 0, 0}, -0.63e-6, 0.00e-6 },
|
---|
137 | {{ 1, 0, 0, 0, 1, 0, 0, 0}, -0.63e-6, 0.00e-6 },
|
---|
138 | {{ 0, 1, 2, -2, 3, 0, 0, 0}, 0.46e-6, 0.00e-6 },
|
---|
139 | {{ 0, 1, 2, -2, 1, 0, 0, 0}, 0.45e-6, 0.00e-6 },
|
---|
140 | {{ 0, 0, 4, -4, 4, 0, 0, 0}, 0.36e-6, 0.00e-6 },
|
---|
141 | {{ 0, 0, 1, -1, 1, -8, 12, 0}, -0.24e-6, -0.12e-6 },
|
---|
142 | {{ 0, 0, 2, 0, 0, 0, 0, 0}, 0.32e-6, 0.00e-6 },
|
---|
143 | {{ 0, 0, 2, 0, 2, 0, 0, 0}, 0.28e-6, 0.00e-6 },
|
---|
144 | {{ 1, 0, 2, 0, 3, 0, 0, 0}, 0.27e-6, 0.00e-6 },
|
---|
145 | {{ 1, 0, 2, 0, 1, 0, 0, 0}, 0.26e-6, 0.00e-6 },
|
---|
146 |
|
---|
147 | /* 21-30 */
|
---|
148 | {{ 0, 0, 2, -2, 0, 0, 0, 0}, -0.21e-6, 0.00e-6 },
|
---|
149 | {{ 0, 1, -2, 2, -3, 0, 0, 0}, 0.19e-6, 0.00e-6 },
|
---|
150 | {{ 0, 1, -2, 2, -1, 0, 0, 0}, 0.18e-6, 0.00e-6 },
|
---|
151 | {{ 0, 0, 0, 0, 0, 8,-13, -1}, -0.10e-6, 0.05e-6 },
|
---|
152 | {{ 0, 0, 0, 2, 0, 0, 0, 0}, 0.15e-6, 0.00e-6 },
|
---|
153 | {{ 2, 0, -2, 0, -1, 0, 0, 0}, -0.14e-6, 0.00e-6 },
|
---|
154 | {{ 1, 0, 0, -2, 1, 0, 0, 0}, 0.14e-6, 0.00e-6 },
|
---|
155 | {{ 0, 1, 2, -2, 2, 0, 0, 0}, -0.14e-6, 0.00e-6 },
|
---|
156 | {{ 1, 0, 0, -2, -1, 0, 0, 0}, 0.14e-6, 0.00e-6 },
|
---|
157 | {{ 0, 0, 4, -2, 4, 0, 0, 0}, 0.13e-6, 0.00e-6 },
|
---|
158 |
|
---|
159 | /* 31-33 */
|
---|
160 | {{ 0, 0, 2, -2, 4, 0, 0, 0}, -0.11e-6, 0.00e-6 },
|
---|
161 | {{ 1, 0, -2, 0, -3, 0, 0, 0}, 0.11e-6, 0.00e-6 },
|
---|
162 | {{ 1, 0, -2, 0, -1, 0, 0, 0}, 0.11e-6, 0.00e-6 }
|
---|
163 | };
|
---|
164 |
|
---|
165 | /* Terms of order t^1 */
|
---|
166 | static const TERM e1[] = {
|
---|
167 | {{ 0, 0, 0, 0, 1, 0, 0, 0}, -0.87e-6, 0.00e-6 }
|
---|
168 | };
|
---|
169 |
|
---|
170 | /* Number of terms in the series */
|
---|
171 | const int NE0 = (int) (sizeof e0 / sizeof (TERM));
|
---|
172 | const int NE1 = (int) (sizeof e1 / sizeof (TERM));
|
---|
173 |
|
---|
174 | /*--------------------------------------------------------------------*/
|
---|
175 |
|
---|
176 | /* Interval between fundamental epoch J2000.0 and current date (JC). */
|
---|
177 | t = ((date1 - ERFA_DJ00) + date2) / ERFA_DJC;
|
---|
178 |
|
---|
179 | /* Fundamental Arguments (from IERS Conventions 2003) */
|
---|
180 |
|
---|
181 | /* Mean anomaly of the Moon. */
|
---|
182 | fa[0] = eraFal03(t);
|
---|
183 |
|
---|
184 | /* Mean anomaly of the Sun. */
|
---|
185 | fa[1] = eraFalp03(t);
|
---|
186 |
|
---|
187 | /* Mean longitude of the Moon minus that of the ascending node. */
|
---|
188 | fa[2] = eraFaf03(t);
|
---|
189 |
|
---|
190 | /* Mean elongation of the Moon from the Sun. */
|
---|
191 | fa[3] = eraFad03(t);
|
---|
192 |
|
---|
193 | /* Mean longitude of the ascending node of the Moon. */
|
---|
194 | fa[4] = eraFaom03(t);
|
---|
195 |
|
---|
196 | /* Mean longitude of Venus. */
|
---|
197 | fa[5] = eraFave03(t);
|
---|
198 |
|
---|
199 | /* Mean longitude of Earth. */
|
---|
200 | fa[6] = eraFae03(t);
|
---|
201 |
|
---|
202 | /* General precession in longitude. */
|
---|
203 | fa[7] = eraFapa03(t);
|
---|
204 |
|
---|
205 | /* Evaluate the EE complementary terms. */
|
---|
206 | s0 = 0.0;
|
---|
207 | s1 = 0.0;
|
---|
208 |
|
---|
209 | for (i = NE0-1; i >= 0; i--) {
|
---|
210 | a = 0.0;
|
---|
211 | for (j = 0; j < 8; j++) {
|
---|
212 | a += (double)(e0[i].nfa[j]) * fa[j];
|
---|
213 | }
|
---|
214 | s0 += e0[i].s * sin(a) + e0[i].c * cos(a);
|
---|
215 | }
|
---|
216 |
|
---|
217 | for (i = NE1-1; i >= 0; i--) {
|
---|
218 | a = 0.0;
|
---|
219 | for (j = 0; j < 8; j++) {
|
---|
220 | a += (double)(e1[i].nfa[j]) * fa[j];
|
---|
221 | }
|
---|
222 | s1 += e1[i].s * sin(a) + e1[i].c * cos(a);
|
---|
223 | }
|
---|
224 |
|
---|
225 | eect = (s0 + s1 * t ) * ERFA_DAS2R;
|
---|
226 |
|
---|
227 | return eect;
|
---|
228 |
|
---|
229 | }
|
---|
230 | /*----------------------------------------------------------------------
|
---|
231 | **
|
---|
232 | **
|
---|
233 | ** Copyright (C) 2013-2016, NumFOCUS Foundation.
|
---|
234 | ** All rights reserved.
|
---|
235 | **
|
---|
236 | ** This library is derived, with permission, from the International
|
---|
237 | ** Astronomical Union's "Standards of Fundamental Astronomy" library,
|
---|
238 | ** available from http://www.iausofa.org.
|
---|
239 | **
|
---|
240 | ** The ERFA version is intended to retain identical functionality to
|
---|
241 | ** the SOFA library, but made distinct through different function and
|
---|
242 | ** file names, as set out in the SOFA license conditions. The SOFA
|
---|
243 | ** original has a role as a reference standard for the IAU and IERS,
|
---|
244 | ** and consequently redistribution is permitted only in its unaltered
|
---|
245 | ** state. The ERFA version is not subject to this restriction and
|
---|
246 | ** therefore can be included in distributions which do not support the
|
---|
247 | ** concept of "read only" software.
|
---|
248 | **
|
---|
249 | ** Although the intent is to replicate the SOFA API (other than
|
---|
250 | ** replacement of prefix names) and results (with the exception of
|
---|
251 | ** bugs; any that are discovered will be fixed), SOFA is not
|
---|
252 | ** responsible for any errors found in this version of the library.
|
---|
253 | **
|
---|
254 | ** If you wish to acknowledge the SOFA heritage, please acknowledge
|
---|
255 | ** that you are using a library derived from SOFA, rather than SOFA
|
---|
256 | ** itself.
|
---|
257 | **
|
---|
258 | **
|
---|
259 | ** TERMS AND CONDITIONS
|
---|
260 | **
|
---|
261 | ** Redistribution and use in source and binary forms, with or without
|
---|
262 | ** modification, are permitted provided that the following conditions
|
---|
263 | ** are met:
|
---|
264 | **
|
---|
265 | ** 1 Redistributions of source code must retain the above copyright
|
---|
266 | ** notice, this list of conditions and the following disclaimer.
|
---|
267 | **
|
---|
268 | ** 2 Redistributions in binary form must reproduce the above copyright
|
---|
269 | ** notice, this list of conditions and the following disclaimer in
|
---|
270 | ** the documentation and/or other materials provided with the
|
---|
271 | ** distribution.
|
---|
272 | **
|
---|
273 | ** 3 Neither the name of the Standards Of Fundamental Astronomy Board,
|
---|
274 | ** the International Astronomical Union nor the names of its
|
---|
275 | ** contributors may be used to endorse or promote products derived
|
---|
276 | ** from this software without specific prior written permission.
|
---|
277 | **
|
---|
278 | ** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
---|
279 | ** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
---|
280 | ** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
|
---|
281 | ** FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
|
---|
282 | ** COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
|
---|
283 | ** INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
|
---|
284 | ** BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
---|
285 | ** LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
---|
286 | ** CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
---|
287 | ** LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
|
---|
288 | ** ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
---|
289 | ** POSSIBILITY OF SUCH DAMAGE.
|
---|
290 | **
|
---|
291 | */
|
---|