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

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