source: trunk/FACT++/sofa/src/aticqn.c@ 18358

Last change on this file since 18358 was 18346, checked in by tbretz, 11 years ago
File size: 10.4 KB
Line 
1#include "sofa.h"
2
3void iauAticqn(double ri, double di, iauASTROM *astrom,
4 int n, iauLDBODY b[], double *rc, double *dc)
5/*
6** - - - - - - - - -
7** i a u A t i c q n
8** - - - - - - - - -
9**
10** Quick CIRS to ICRS astrometric place transformation, given the star-
11** independent astrometry parameters plus a list of light-deflecting
12** bodies.
13**
14** Use of this function is appropriate when efficiency is important and
15** where many star positions are all to be transformed for one date.
16** The star-independent astrometry parameters can be obtained by
17** calling one of the functions iauApci[13], iauApcg[13], iauApco[13]
18** or iauApcs[13].
19*
20* If the only light-deflecting body to be taken into account is the
21* Sun, the iauAticq function can be used instead.
22**
23** This function is part of the International Astronomical Union's
24** SOFA (Standards of Fundamental Astronomy) software collection.
25**
26** Status: support function.
27**
28** Given:
29** ri,di double CIRS RA,Dec (radians)
30** astrom iauASTROM* star-independent astrometry parameters:
31** pmt double PM time interval (SSB, Julian years)
32** eb double[3] SSB to observer (vector, au)
33** eh double[3] Sun to observer (unit vector)
34** em double distance from Sun to observer (au)
35** v double[3] barycentric observer velocity (vector, c)
36** bm1 double sqrt(1-|v|^2): reciprocal of Lorenz factor
37** bpn double[3][3] bias-precession-nutation matrix
38** along double longitude + s' (radians)
39** xpl double polar motion xp wrt local meridian (radians)
40** ypl double polar motion yp wrt local meridian (radians)
41** sphi double sine of geodetic latitude
42** cphi double cosine of geodetic latitude
43** diurab double magnitude of diurnal aberration vector
44** eral double "local" Earth rotation angle (radians)
45** refa double refraction constant A (radians)
46** refb double refraction constant B (radians)
47** n int number of bodies (Note 3)
48** b iauLDBODY[n] data for each of the n bodies (Notes 3,4):
49** bm double mass of the body (solar masses, Note 5)
50** dl double deflection limiter (Note 6)
51** pv [2][3] barycentric PV of the body (au, au/day)
52**
53** Returned:
54** rc,dc double ICRS astrometric RA,Dec (radians)
55**
56** Notes:
57**
58** 1) Iterative techniques are used for the aberration and light
59** deflection corrections so that the functions iauAticqn and
60** iauAtciqn are accurate inverses; even at the edge of the Sun's
61** disk the discrepancy is only about 1 nanoarcsecond.
62**
63** 2) If the only light-deflecting body to be taken into account is the
64** Sun, the iauAticq function can be used instead.
65**
66** 3) The struct b contains n entries, one for each body to be
67** considered. If n = 0, no gravitational light deflection will be
68** applied, not even for the Sun.
69**
70** 4) The struct b should include an entry for the Sun as well as for
71** any planet or other body to be taken into account. The entries
72** should be in the order in which the light passes the body.
73**
74** 5) In the entry in the b struct for body i, the mass parameter
75** b[i].bm can, as required, be adjusted in order to allow for such
76** effects as quadrupole field.
77**
78** 6) The deflection limiter parameter b[i].dl is phi^2/2, where phi is
79** the angular separation (in radians) between star and body at
80** which limiting is applied. As phi shrinks below the chosen
81** threshold, the deflection is artificially reduced, reaching zero
82** for phi = 0. Example values suitable for a terrestrial
83** observer, together with masses, are as follows:
84**
85** body i b[i].bm b[i].dl
86**
87** Sun 1.0 6e-6
88** Jupiter 0.00095435 3e-9
89** Saturn 0.00028574 3e-10
90**
91** 7) For efficiency, validation of the contents of the b array is
92** omitted. The supplied masses must be greater than zero, the
93** position and velocity vectors must be right, and the deflection
94** limiter greater than zero.
95**
96** Called:
97** iauS2c spherical coordinates to unit vector
98** iauTrxp product of transpose of r-matrix and p-vector
99** iauZp zero p-vector
100** iauAb stellar aberration
101** iauLdn light deflection by n bodies
102** iauC2s p-vector to spherical
103** iauAnp normalize angle into range +/- pi
104**
105** This revision: 2013 October 9
106**
107** SOFA release 2015-02-09
108**
109** Copyright (C) 2015 IAU SOFA Board. See notes at end.
110*/
111{
112 int j, i;
113 double pi[3], ppr[3], pnat[3], pco[3], w, d[3], before[3], r2, r,
114 after[3];
115
116/* CIRS RA,Dec to Cartesian. */
117 iauS2c(ri, di, pi);
118
119/* Bias-precession-nutation, giving GCRS proper direction. */
120 iauTrxp(astrom->bpn, pi, ppr);
121
122/* Aberration, giving GCRS natural direction. */
123 iauZp(d);
124 for (j = 0; j < 2; j++) {
125 r2 = 0.0;
126 for (i = 0; i < 3; i++) {
127 w = ppr[i] - d[i];
128 before[i] = w;
129 r2 += w*w;
130 }
131 r = sqrt(r2);
132 for (i = 0; i < 3; i++) {
133 before[i] /= r;
134 }
135 iauAb(before, astrom->v, astrom->em, astrom->bm1, after);
136 r2 = 0.0;
137 for (i = 0; i < 3; i++) {
138 d[i] = after[i] - before[i];
139 w = ppr[i] - d[i];
140 pnat[i] = w;
141 r2 += w*w;
142 }
143 r = sqrt(r2);
144 for (i = 0; i < 3; i++) {
145 pnat[i] /= r;
146 }
147 }
148
149/* Light deflection, giving BCRS coordinate direction. */
150 iauZp(d);
151 for (j = 0; j < 5; j++) {
152 r2 = 0.0;
153 for (i = 0; i < 3; i++) {
154 w = pnat[i] - d[i];
155 before[i] = w;
156 r2 += w*w;
157 }
158 r = sqrt(r2);
159 for (i = 0; i < 3; i++) {
160 before[i] /= r;
161 }
162 iauLdn(n, b, astrom->eb, before, after);
163 r2 = 0.0;
164 for (i = 0; i < 3; i++) {
165 d[i] = after[i] - before[i];
166 w = pnat[i] - d[i];
167 pco[i] = w;
168 r2 += w*w;
169 }
170 r = sqrt(r2);
171 for (i = 0; i < 3; i++) {
172 pco[i] /= r;
173 }
174 }
175
176/* ICRS astrometric RA,Dec. */
177 iauC2s(pco, &w, dc);
178 *rc = iauAnp(w);
179
180/* Finished. */
181
182/*----------------------------------------------------------------------
183**
184** Copyright (C) 2015
185** Standards Of Fundamental Astronomy Board
186** of the International Astronomical Union.
187**
188** =====================
189** SOFA Software License
190** =====================
191**
192** NOTICE TO USER:
193**
194** BY USING THIS SOFTWARE YOU ACCEPT THE FOLLOWING SIX TERMS AND
195** CONDITIONS WHICH APPLY TO ITS USE.
196**
197** 1. The Software is owned by the IAU SOFA Board ("SOFA").
198**
199** 2. Permission is granted to anyone to use the SOFA software for any
200** purpose, including commercial applications, free of charge and
201** without payment of royalties, subject to the conditions and
202** restrictions listed below.
203**
204** 3. You (the user) may copy and distribute SOFA source code to others,
205** and use and adapt its code and algorithms in your own software,
206** on a world-wide, royalty-free basis. That portion of your
207** distribution that does not consist of intact and unchanged copies
208** of SOFA source code files is a "derived work" that must comply
209** with the following requirements:
210**
211** a) Your work shall be marked or carry a statement that it
212** (i) uses routines and computations derived by you from
213** software provided by SOFA under license to you; and
214** (ii) does not itself constitute software provided by and/or
215** endorsed by SOFA.
216**
217** b) The source code of your derived work must contain descriptions
218** of how the derived work is based upon, contains and/or differs
219** from the original SOFA software.
220**
221** c) The names of all routines in your derived work shall not
222** include the prefix "iau" or "sofa" or trivial modifications
223** thereof such as changes of case.
224**
225** d) The origin of the SOFA components of your derived work must
226** not be misrepresented; you must not claim that you wrote the
227** original software, nor file a patent application for SOFA
228** software or algorithms embedded in the SOFA software.
229**
230** e) These requirements must be reproduced intact in any source
231** distribution and shall apply to anyone to whom you have
232** granted a further right to modify the source code of your
233** derived work.
234**
235** Note that, as originally distributed, the SOFA software is
236** intended to be a definitive implementation of the IAU standards,
237** and consequently third-party modifications are discouraged. All
238** variations, no matter how minor, must be explicitly marked as
239** such, as explained above.
240**
241** 4. You shall not cause the SOFA software to be brought into
242** disrepute, either by misuse, or use for inappropriate tasks, or
243** by inappropriate modification.
244**
245** 5. The SOFA software is provided "as is" and SOFA makes no warranty
246** as to its use or performance. SOFA does not and cannot warrant
247** the performance or results which the user may obtain by using the
248** SOFA software. SOFA makes no warranties, express or implied, as
249** to non-infringement of third party rights, merchantability, or
250** fitness for any particular purpose. In no event will SOFA be
251** liable to the user for any consequential, incidental, or special
252** damages, including any lost profits or lost savings, even if a
253** SOFA representative has been advised of such damages, or for any
254** claim by any third party.
255**
256** 6. The provision of any version of the SOFA software under the terms
257** and conditions specified herein does not imply that future
258** versions will also be made available under the same terms and
259** conditions.
260*
261** In any published work or commercial product which uses the SOFA
262** software directly, acknowledgement (see www.iausofa.org) is
263** appreciated.
264**
265** Correspondence concerning SOFA software should be addressed as
266** follows:
267**
268** By email: sofa@ukho.gov.uk
269** By post: IAU SOFA Center
270** HM Nautical Almanac Office
271** UK Hydrographic Office
272** Admiralty Way, Taunton
273** Somerset, TA1 2DN
274** United Kingdom
275**
276**--------------------------------------------------------------------*/
277
278}
Note: See TracBrowser for help on using the repository browser.