source: branches/FACT++_part_filenames/erfa/src/apcs.c@ 19133

Last change on this file since 19133 was 18711, checked in by tbretz, 8 years ago
Updated to ERFA 1.3.0 (no relevant code change except the leap second at the beginning of 2017)
File size: 9.3 KB
Line 
1#include "erfa.h"
2
3void eraApcs(double date1, double date2, double pv[2][3],
4 double ebpv[2][3], double ehp[3],
5 eraASTROM *astrom)
6/*
7** - - - - - - - -
8** e r a A p c s
9** - - - - - - - -
10**
11** For an observer whose geocentric position and velocity are known,
12** prepare star-independent astrometry parameters for transformations
13** between ICRS and GCRS. The Earth ephemeris is supplied by the
14** caller.
15**
16** The parameters produced by this function are required in the space
17** motion, parallax, light deflection and aberration parts of the
18** astrometric transformation chain.
19**
20** Given:
21** date1 double TDB as a 2-part...
22** date2 double ...Julian Date (Note 1)
23** pv double[2][3] observer's geocentric pos/vel (m, m/s)
24** ebpv double[2][3] Earth barycentric PV (au, au/day)
25** ehp double[3] Earth heliocentric P (au)
26**
27** Returned:
28** astrom eraASTROM* star-independent astrometry parameters:
29** pmt double PM time interval (SSB, Julian years)
30** eb double[3] SSB to observer (vector, au)
31** eh double[3] Sun to observer (unit vector)
32** em double distance from Sun to observer (au)
33** v double[3] barycentric observer velocity (vector, c)
34** bm1 double sqrt(1-|v|^2): reciprocal of Lorenz factor
35** bpn double[3][3] bias-precession-nutation matrix
36** along double unchanged
37** xpl double unchanged
38** ypl double unchanged
39** sphi double unchanged
40** cphi double unchanged
41** diurab double unchanged
42** eral double unchanged
43** refa double unchanged
44** refb double unchanged
45**
46** Notes:
47**
48** 1) The TDB date date1+date2 is a Julian Date, apportioned in any
49** convenient way between the two arguments. For example,
50** JD(TDB)=2450123.7 could be expressed in any of these ways, among
51** others:
52**
53** date1 date2
54**
55** 2450123.7 0.0 (JD method)
56** 2451545.0 -1421.3 (J2000 method)
57** 2400000.5 50123.2 (MJD method)
58** 2450123.5 0.2 (date & time method)
59**
60** The JD method is the most natural and convenient to use in cases
61** where the loss of several decimal digits of resolution is
62** acceptable. The J2000 method is best matched to the way the
63** argument is handled internally and will deliver the optimum
64** resolution. The MJD method and the date & time methods are both
65** good compromises between resolution and convenience. For most
66** applications of this function the choice will not be at all
67** critical.
68**
69** TT can be used instead of TDB without any significant impact on
70** accuracy.
71**
72** 2) All the vectors are with respect to BCRS axes.
73**
74** 3) Providing separate arguments for (i) the observer's geocentric
75** position and velocity and (ii) the Earth ephemeris is done for
76** convenience in the geocentric, terrestrial and Earth orbit cases.
77** For deep space applications it maybe more convenient to specify
78** zero geocentric position and velocity and to supply the
79** observer's position and velocity information directly instead of
80** with respect to the Earth. However, note the different units:
81** m and m/s for the geocentric vectors, au and au/day for the
82** heliocentric and barycentric vectors.
83**
84** 4) In cases where the caller does not wish to provide the Earth
85** ephemeris, the function eraApcs13 can be used instead of the
86** present function. This computes the Earth ephemeris using the
87** ERFA function eraEpv00.
88**
89** 5) This is one of several functions that inserts into the astrom
90** structure star-independent parameters needed for the chain of
91** astrometric transformations ICRS <-> GCRS <-> CIRS <-> observed.
92**
93** The various functions support different classes of observer and
94** portions of the transformation chain:
95**
96** functions observer transformation
97**
98** eraApcg eraApcg13 geocentric ICRS <-> GCRS
99** eraApci eraApci13 terrestrial ICRS <-> CIRS
100** eraApco eraApco13 terrestrial ICRS <-> observed
101** eraApcs eraApcs13 space ICRS <-> GCRS
102** eraAper eraAper13 terrestrial update Earth rotation
103** eraApio eraApio13 terrestrial CIRS <-> observed
104**
105** Those with names ending in "13" use contemporary ERFA models to
106** compute the various ephemerides. The others accept ephemerides
107** supplied by the caller.
108**
109** The transformation from ICRS to GCRS covers space motion,
110** parallax, light deflection, and aberration. From GCRS to CIRS
111** comprises frame bias and precession-nutation. From CIRS to
112** observed takes account of Earth rotation, polar motion, diurnal
113** aberration and parallax (unless subsumed into the ICRS <-> GCRS
114** transformation), and atmospheric refraction.
115**
116** 6) The context structure astrom produced by this function is used by
117** eraAtciq* and eraAticq*.
118**
119** Called:
120** eraCp copy p-vector
121** eraPm modulus of p-vector
122** eraPn decompose p-vector into modulus and direction
123** eraIr initialize r-matrix to identity
124**
125** Copyright (C) 2013-2016, NumFOCUS Foundation.
126** Derived, with permission, from the SOFA library. See notes at end of file.
127*/
128{
129/* au/d to m/s */
130 const double AUDMS = ERFA_DAU/ERFA_DAYSEC;
131
132/* Light time for 1 AU (day) */
133 const double CR = ERFA_AULT/ERFA_DAYSEC;
134
135 int i;
136 double dp, dv, pb[3], vb[3], ph[3], v2, w;
137
138
139/* Time since reference epoch, years (for proper motion calculation). */
140 astrom->pmt = ( (date1 - ERFA_DJ00) + date2 ) / ERFA_DJY;
141
142/* Adjust Earth ephemeris to observer. */
143 for (i = 0; i < 3; i++) {
144 dp = pv[0][i] / ERFA_DAU;
145 dv = pv[1][i] / AUDMS;
146 pb[i] = ebpv[0][i] + dp;
147 vb[i] = ebpv[1][i] + dv;
148 ph[i] = ehp[i] + dp;
149 }
150
151/* Barycentric position of observer (au). */
152 eraCp(pb, astrom->eb);
153
154/* Heliocentric direction and distance (unit vector and au). */
155 eraPn(ph, &astrom->em, astrom->eh);
156
157/* Barycentric vel. in units of c, and reciprocal of Lorenz factor. */
158 v2 = 0.0;
159 for (i = 0; i < 3; i++) {
160 w = vb[i] * CR;
161 astrom->v[i] = w;
162 v2 += w*w;
163 }
164 astrom->bm1 = sqrt(1.0 - v2);
165
166/* Reset the NPB matrix. */
167 eraIr(astrom->bpn);
168
169/* Finished. */
170
171}
172/*----------------------------------------------------------------------
173**
174**
175** Copyright (C) 2013-2016, NumFOCUS Foundation.
176** All rights reserved.
177**
178** This library is derived, with permission, from the International
179** Astronomical Union's "Standards of Fundamental Astronomy" library,
180** available from http://www.iausofa.org.
181**
182** The ERFA version is intended to retain identical functionality to
183** the SOFA library, but made distinct through different function and
184** file names, as set out in the SOFA license conditions. The SOFA
185** original has a role as a reference standard for the IAU and IERS,
186** and consequently redistribution is permitted only in its unaltered
187** state. The ERFA version is not subject to this restriction and
188** therefore can be included in distributions which do not support the
189** concept of "read only" software.
190**
191** Although the intent is to replicate the SOFA API (other than
192** replacement of prefix names) and results (with the exception of
193** bugs; any that are discovered will be fixed), SOFA is not
194** responsible for any errors found in this version of the library.
195**
196** If you wish to acknowledge the SOFA heritage, please acknowledge
197** that you are using a library derived from SOFA, rather than SOFA
198** itself.
199**
200**
201** TERMS AND CONDITIONS
202**
203** Redistribution and use in source and binary forms, with or without
204** modification, are permitted provided that the following conditions
205** are met:
206**
207** 1 Redistributions of source code must retain the above copyright
208** notice, this list of conditions and the following disclaimer.
209**
210** 2 Redistributions in binary form must reproduce the above copyright
211** notice, this list of conditions and the following disclaimer in
212** the documentation and/or other materials provided with the
213** distribution.
214**
215** 3 Neither the name of the Standards Of Fundamental Astronomy Board,
216** the International Astronomical Union nor the names of its
217** contributors may be used to endorse or promote products derived
218** from this software without specific prior written permission.
219**
220** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
221** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
222** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
223** FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
224** COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
225** INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
226** BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
227** LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
228** CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
229** LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
230** ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
231** POSSIBILITY OF SUCH DAMAGE.
232**
233*/
Note: See TracBrowser for help on using the repository browser.