source: trunk/FACT++/sofa/src/s00.c@ 18375

Last change on this file since 18375 was 18346, checked in by tbretz, 11 years ago
File size: 15.2 KB
Line 
1#include "sofa.h"
2
3double iauS00(double date1, double date2, double x, double y)
4/*
5** - - - - - - -
6** i a u S 0 0
7** - - - - - - -
8**
9** The CIO locator s, positioning the Celestial Intermediate Origin on
10** the equator of the Celestial Intermediate Pole, given the CIP's X,Y
11** coordinates. Compatible with IAU 2000A precession-nutation.
12**
13** This function is part of the International Astronomical Union's
14** SOFA (Standards Of Fundamental Astronomy) software collection.
15**
16** Status: canonical model.
17**
18** Given:
19** date1,date2 double TT as a 2-part Julian Date (Note 1)
20** x,y double CIP coordinates (Note 3)
21**
22** Returned (function value):
23** double the CIO locator s in radians (Note 2)
24**
25** Notes:
26**
27** 1) The TT date date1+date2 is a Julian Date, apportioned in any
28** convenient way between the two arguments. For example,
29** JD(TT)=2450123.7 could be expressed in any of these ways,
30** among others:
31**
32** date1 date2
33**
34** 2450123.7 0.0 (JD method)
35** 2451545.0 -1421.3 (J2000 method)
36** 2400000.5 50123.2 (MJD method)
37** 2450123.5 0.2 (date & time method)
38**
39** The JD method is the most natural and convenient to use in
40** cases where the loss of several decimal digits of resolution
41** is acceptable. The J2000 method is best matched to the way
42** the argument is handled internally and will deliver the
43** optimum resolution. The MJD method and the date & time methods
44** are both good compromises between resolution and convenience.
45**
46** 2) The CIO locator s is the difference between the right ascensions
47** of the same point in two systems: the two systems are the GCRS
48** and the CIP,CIO, and the point is the ascending node of the
49** CIP equator. The quantity s remains below 0.1 arcsecond
50** throughout 1900-2100.
51**
52** 3) The series used to compute s is in fact for s+XY/2, where X and Y
53** are the x and y components of the CIP unit vector; this series
54** is more compact than a direct series for s would be. This
55** function requires X,Y to be supplied by the caller, who is
56** responsible for providing values that are consistent with the
57** supplied date.
58**
59** 4) The model is consistent with the IAU 2000A precession-nutation.
60**
61** Called:
62** iauFal03 mean anomaly of the Moon
63** iauFalp03 mean anomaly of the Sun
64** iauFaf03 mean argument of the latitude of the Moon
65** iauFad03 mean elongation of the Moon from the Sun
66** iauFaom03 mean longitude of the Moon's ascending node
67** iauFave03 mean longitude of Venus
68** iauFae03 mean longitude of Earth
69** iauFapa03 general accumulated precession in longitude
70**
71** References:
72**
73** Capitaine, N., Chapront, J., Lambert, S. and Wallace, P.,
74** "Expressions for the Celestial Intermediate Pole and Celestial
75** Ephemeris Origin consistent with the IAU 2000A precession-
76** nutation model", Astron.Astrophys. 400, 1145-1154 (2003)
77**
78** n.b. The celestial ephemeris origin (CEO) was renamed "celestial
79** intermediate origin" (CIO) by IAU 2006 Resolution 2.
80**
81** McCarthy, D. D., Petit, G. (eds.), IERS Conventions (2003),
82** IERS Technical Note No. 32, BKG (2004)
83**
84** This revision: 2013 June 18
85**
86** SOFA release 2015-02-09
87**
88** Copyright (C) 2015 IAU SOFA Board. See notes at end.
89*/
90{
91/* Time since J2000.0, in Julian centuries */
92 double t;
93
94/* Miscellaneous */
95 int i, j;
96 double a, w0, w1, w2, w3, w4, w5;
97
98/* Fundamental arguments */
99 double fa[8];
100
101/* Returned value */
102 double s;
103
104/* --------------------- */
105/* The series for s+XY/2 */
106/* --------------------- */
107
108 typedef struct {
109 int nfa[8]; /* coefficients of l,l',F,D,Om,LVe,LE,pA */
110 double s, c; /* sine and cosine coefficients */
111 } TERM;
112
113/* Polynomial coefficients */
114 static const double sp[] = {
115
116 /* 1-6 */
117 94.00e-6,
118 3808.35e-6,
119 -119.94e-6,
120 -72574.09e-6,
121 27.70e-6,
122 15.61e-6
123 };
124
125/* Terms of order t^0 */
126 static const TERM s0[] = {
127
128 /* 1-10 */
129 {{ 0, 0, 0, 0, 1, 0, 0, 0}, -2640.73e-6, 0.39e-6 },
130 {{ 0, 0, 0, 0, 2, 0, 0, 0}, -63.53e-6, 0.02e-6 },
131 {{ 0, 0, 2, -2, 3, 0, 0, 0}, -11.75e-6, -0.01e-6 },
132 {{ 0, 0, 2, -2, 1, 0, 0, 0}, -11.21e-6, -0.01e-6 },
133 {{ 0, 0, 2, -2, 2, 0, 0, 0}, 4.57e-6, 0.00e-6 },
134 {{ 0, 0, 2, 0, 3, 0, 0, 0}, -2.02e-6, 0.00e-6 },
135 {{ 0, 0, 2, 0, 1, 0, 0, 0}, -1.98e-6, 0.00e-6 },
136 {{ 0, 0, 0, 0, 3, 0, 0, 0}, 1.72e-6, 0.00e-6 },
137 {{ 0, 1, 0, 0, 1, 0, 0, 0}, 1.41e-6, 0.01e-6 },
138 {{ 0, 1, 0, 0, -1, 0, 0, 0}, 1.26e-6, 0.01e-6 },
139
140 /* 11-20 */
141 {{ 1, 0, 0, 0, -1, 0, 0, 0}, 0.63e-6, 0.00e-6 },
142 {{ 1, 0, 0, 0, 1, 0, 0, 0}, 0.63e-6, 0.00e-6 },
143 {{ 0, 1, 2, -2, 3, 0, 0, 0}, -0.46e-6, 0.00e-6 },
144 {{ 0, 1, 2, -2, 1, 0, 0, 0}, -0.45e-6, 0.00e-6 },
145 {{ 0, 0, 4, -4, 4, 0, 0, 0}, -0.36e-6, 0.00e-6 },
146 {{ 0, 0, 1, -1, 1, -8, 12, 0}, 0.24e-6, 0.12e-6 },
147 {{ 0, 0, 2, 0, 0, 0, 0, 0}, -0.32e-6, 0.00e-6 },
148 {{ 0, 0, 2, 0, 2, 0, 0, 0}, -0.28e-6, 0.00e-6 },
149 {{ 1, 0, 2, 0, 3, 0, 0, 0}, -0.27e-6, 0.00e-6 },
150 {{ 1, 0, 2, 0, 1, 0, 0, 0}, -0.26e-6, 0.00e-6 },
151
152 /* 21-30 */
153 {{ 0, 0, 2, -2, 0, 0, 0, 0}, 0.21e-6, 0.00e-6 },
154 {{ 0, 1, -2, 2, -3, 0, 0, 0}, -0.19e-6, 0.00e-6 },
155 {{ 0, 1, -2, 2, -1, 0, 0, 0}, -0.18e-6, 0.00e-6 },
156 {{ 0, 0, 0, 0, 0, 8,-13, -1}, 0.10e-6, -0.05e-6 },
157 {{ 0, 0, 0, 2, 0, 0, 0, 0}, -0.15e-6, 0.00e-6 },
158 {{ 2, 0, -2, 0, -1, 0, 0, 0}, 0.14e-6, 0.00e-6 },
159 {{ 0, 1, 2, -2, 2, 0, 0, 0}, 0.14e-6, 0.00e-6 },
160 {{ 1, 0, 0, -2, 1, 0, 0, 0}, -0.14e-6, 0.00e-6 },
161 {{ 1, 0, 0, -2, -1, 0, 0, 0}, -0.14e-6, 0.00e-6 },
162 {{ 0, 0, 4, -2, 4, 0, 0, 0}, -0.13e-6, 0.00e-6 },
163
164 /* 31-33 */
165 {{ 0, 0, 2, -2, 4, 0, 0, 0}, 0.11e-6, 0.00e-6 },
166 {{ 1, 0, -2, 0, -3, 0, 0, 0}, -0.11e-6, 0.00e-6 },
167 {{ 1, 0, -2, 0, -1, 0, 0, 0}, -0.11e-6, 0.00e-6 }
168 };
169
170/* Terms of order t^1 */
171 static const TERM s1[] ={
172
173 /* 1-3 */
174 {{ 0, 0, 0, 0, 2, 0, 0, 0}, -0.07e-6, 3.57e-6 },
175 {{ 0, 0, 0, 0, 1, 0, 0, 0}, 1.71e-6, -0.03e-6 },
176 {{ 0, 0, 2, -2, 3, 0, 0, 0}, 0.00e-6, 0.48e-6 }
177 };
178
179/* Terms of order t^2 */
180 static const TERM s2[] ={
181
182 /* 1-10 */
183 {{ 0, 0, 0, 0, 1, 0, 0, 0}, 743.53e-6, -0.17e-6 },
184 {{ 0, 0, 2, -2, 2, 0, 0, 0}, 56.91e-6, 0.06e-6 },
185 {{ 0, 0, 2, 0, 2, 0, 0, 0}, 9.84e-6, -0.01e-6 },
186 {{ 0, 0, 0, 0, 2, 0, 0, 0}, -8.85e-6, 0.01e-6 },
187 {{ 0, 1, 0, 0, 0, 0, 0, 0}, -6.38e-6, -0.05e-6 },
188 {{ 1, 0, 0, 0, 0, 0, 0, 0}, -3.07e-6, 0.00e-6 },
189 {{ 0, 1, 2, -2, 2, 0, 0, 0}, 2.23e-6, 0.00e-6 },
190 {{ 0, 0, 2, 0, 1, 0, 0, 0}, 1.67e-6, 0.00e-6 },
191 {{ 1, 0, 2, 0, 2, 0, 0, 0}, 1.30e-6, 0.00e-6 },
192 {{ 0, 1, -2, 2, -2, 0, 0, 0}, 0.93e-6, 0.00e-6 },
193
194 /* 11-20 */
195 {{ 1, 0, 0, -2, 0, 0, 0, 0}, 0.68e-6, 0.00e-6 },
196 {{ 0, 0, 2, -2, 1, 0, 0, 0}, -0.55e-6, 0.00e-6 },
197 {{ 1, 0, -2, 0, -2, 0, 0, 0}, 0.53e-6, 0.00e-6 },
198 {{ 0, 0, 0, 2, 0, 0, 0, 0}, -0.27e-6, 0.00e-6 },
199 {{ 1, 0, 0, 0, 1, 0, 0, 0}, -0.27e-6, 0.00e-6 },
200 {{ 1, 0, -2, -2, -2, 0, 0, 0}, -0.26e-6, 0.00e-6 },
201 {{ 1, 0, 0, 0, -1, 0, 0, 0}, -0.25e-6, 0.00e-6 },
202 {{ 1, 0, 2, 0, 1, 0, 0, 0}, 0.22e-6, 0.00e-6 },
203 {{ 2, 0, 0, -2, 0, 0, 0, 0}, -0.21e-6, 0.00e-6 },
204 {{ 2, 0, -2, 0, -1, 0, 0, 0}, 0.20e-6, 0.00e-6 },
205
206 /* 21-25 */
207 {{ 0, 0, 2, 2, 2, 0, 0, 0}, 0.17e-6, 0.00e-6 },
208 {{ 2, 0, 2, 0, 2, 0, 0, 0}, 0.13e-6, 0.00e-6 },
209 {{ 2, 0, 0, 0, 0, 0, 0, 0}, -0.13e-6, 0.00e-6 },
210 {{ 1, 0, 2, -2, 2, 0, 0, 0}, -0.12e-6, 0.00e-6 },
211 {{ 0, 0, 2, 0, 0, 0, 0, 0}, -0.11e-6, 0.00e-6 }
212 };
213
214/* Terms of order t^3 */
215 static const TERM s3[] ={
216
217 /* 1-4 */
218 {{ 0, 0, 0, 0, 1, 0, 0, 0}, 0.30e-6, -23.51e-6 },
219 {{ 0, 0, 2, -2, 2, 0, 0, 0}, -0.03e-6, -1.39e-6 },
220 {{ 0, 0, 2, 0, 2, 0, 0, 0}, -0.01e-6, -0.24e-6 },
221 {{ 0, 0, 0, 0, 2, 0, 0, 0}, 0.00e-6, 0.22e-6 }
222 };
223
224/* Terms of order t^4 */
225 static const TERM s4[] ={
226
227 /* 1-1 */
228 {{ 0, 0, 0, 0, 1, 0, 0, 0}, -0.26e-6, -0.01e-6 }
229 };
230
231/* Number of terms in the series */
232 const int NS0 = (int) (sizeof s0 / sizeof (TERM));
233 const int NS1 = (int) (sizeof s1 / sizeof (TERM));
234 const int NS2 = (int) (sizeof s2 / sizeof (TERM));
235 const int NS3 = (int) (sizeof s3 / sizeof (TERM));
236 const int NS4 = (int) (sizeof s4 / sizeof (TERM));
237
238/*--------------------------------------------------------------------*/
239
240/* Interval between fundamental epoch J2000.0 and current date (JC). */
241 t = ((date1 - DJ00) + date2) / DJC;
242
243/* Fundamental Arguments (from IERS Conventions 2003) */
244
245/* Mean anomaly of the Moon. */
246 fa[0] = iauFal03(t);
247
248/* Mean anomaly of the Sun. */
249 fa[1] = iauFalp03(t);
250
251/* Mean longitude of the Moon minus that of the ascending node. */
252 fa[2] = iauFaf03(t);
253
254/* Mean elongation of the Moon from the Sun. */
255 fa[3] = iauFad03(t);
256
257/* Mean longitude of the ascending node of the Moon. */
258 fa[4] = iauFaom03(t);
259
260/* Mean longitude of Venus. */
261 fa[5] = iauFave03(t);
262
263/* Mean longitude of Earth. */
264 fa[6] = iauFae03(t);
265
266/* General precession in longitude. */
267 fa[7] = iauFapa03(t);
268
269/* Evaluate s. */
270 w0 = sp[0];
271 w1 = sp[1];
272 w2 = sp[2];
273 w3 = sp[3];
274 w4 = sp[4];
275 w5 = sp[5];
276
277 for (i = NS0-1; i >= 0; i--) {
278 a = 0.0;
279 for (j = 0; j < 8; j++) {
280 a += (double)s0[i].nfa[j] * fa[j];
281 }
282 w0 += s0[i].s * sin(a) + s0[i].c * cos(a);
283 }
284
285 for (i = NS1-1; i >= 0; i--) {
286 a = 0.0;
287 for (j = 0; j < 8; j++) {
288 a += (double)s1[i].nfa[j] * fa[j];
289 }
290 w1 += s1[i].s * sin(a) + s1[i].c * cos(a);
291 }
292
293 for (i = NS2-1; i >= 0; i--) {
294 a = 0.0;
295 for (j = 0; j < 8; j++) {
296 a += (double)s2[i].nfa[j] * fa[j];
297 }
298 w2 += s2[i].s * sin(a) + s2[i].c * cos(a);
299 }
300
301 for (i = NS3-1; i >= 0; i--) {
302 a = 0.0;
303 for (j = 0; j < 8; j++) {
304 a += (double)s3[i].nfa[j] * fa[j];
305 }
306 w3 += s3[i].s * sin(a) + s3[i].c * cos(a);
307 }
308
309 for (i = NS4-1; i >= 0; i--) {
310 a = 0.0;
311 for (j = 0; j < 8; j++) {
312 a += (double)s4[i].nfa[j] * fa[j];
313 }
314 w4 += s4[i].s * sin(a) + s4[i].c * cos(a);
315 }
316
317 s = (w0 +
318 (w1 +
319 (w2 +
320 (w3 +
321 (w4 +
322 w5 * t) * t) * t) * t) * t) * DAS2R - x*y/2.0;
323
324 return s;
325
326/*----------------------------------------------------------------------
327**
328** Copyright (C) 2015
329** Standards Of Fundamental Astronomy Board
330** of the International Astronomical Union.
331**
332** =====================
333** SOFA Software License
334** =====================
335**
336** NOTICE TO USER:
337**
338** BY USING THIS SOFTWARE YOU ACCEPT THE FOLLOWING SIX TERMS AND
339** CONDITIONS WHICH APPLY TO ITS USE.
340**
341** 1. The Software is owned by the IAU SOFA Board ("SOFA").
342**
343** 2. Permission is granted to anyone to use the SOFA software for any
344** purpose, including commercial applications, free of charge and
345** without payment of royalties, subject to the conditions and
346** restrictions listed below.
347**
348** 3. You (the user) may copy and distribute SOFA source code to others,
349** and use and adapt its code and algorithms in your own software,
350** on a world-wide, royalty-free basis. That portion of your
351** distribution that does not consist of intact and unchanged copies
352** of SOFA source code files is a "derived work" that must comply
353** with the following requirements:
354**
355** a) Your work shall be marked or carry a statement that it
356** (i) uses routines and computations derived by you from
357** software provided by SOFA under license to you; and
358** (ii) does not itself constitute software provided by and/or
359** endorsed by SOFA.
360**
361** b) The source code of your derived work must contain descriptions
362** of how the derived work is based upon, contains and/or differs
363** from the original SOFA software.
364**
365** c) The names of all routines in your derived work shall not
366** include the prefix "iau" or "sofa" or trivial modifications
367** thereof such as changes of case.
368**
369** d) The origin of the SOFA components of your derived work must
370** not be misrepresented; you must not claim that you wrote the
371** original software, nor file a patent application for SOFA
372** software or algorithms embedded in the SOFA software.
373**
374** e) These requirements must be reproduced intact in any source
375** distribution and shall apply to anyone to whom you have
376** granted a further right to modify the source code of your
377** derived work.
378**
379** Note that, as originally distributed, the SOFA software is
380** intended to be a definitive implementation of the IAU standards,
381** and consequently third-party modifications are discouraged. All
382** variations, no matter how minor, must be explicitly marked as
383** such, as explained above.
384**
385** 4. You shall not cause the SOFA software to be brought into
386** disrepute, either by misuse, or use for inappropriate tasks, or
387** by inappropriate modification.
388**
389** 5. The SOFA software is provided "as is" and SOFA makes no warranty
390** as to its use or performance. SOFA does not and cannot warrant
391** the performance or results which the user may obtain by using the
392** SOFA software. SOFA makes no warranties, express or implied, as
393** to non-infringement of third party rights, merchantability, or
394** fitness for any particular purpose. In no event will SOFA be
395** liable to the user for any consequential, incidental, or special
396** damages, including any lost profits or lost savings, even if a
397** SOFA representative has been advised of such damages, or for any
398** claim by any third party.
399**
400** 6. The provision of any version of the SOFA software under the terms
401** and conditions specified herein does not imply that future
402** versions will also be made available under the same terms and
403** conditions.
404*
405** In any published work or commercial product which uses the SOFA
406** software directly, acknowledgement (see www.iausofa.org) is
407** appreciated.
408**
409** Correspondence concerning SOFA software should be addressed as
410** follows:
411**
412** By email: sofa@ukho.gov.uk
413** By post: IAU SOFA Center
414** HM Nautical Almanac Office
415** UK Hydrographic Office
416** Admiralty Way, Taunton
417** Somerset, TA1 2DN
418** United Kingdom
419**
420**--------------------------------------------------------------------*/
421}
Note: See TracBrowser for help on using the repository browser.