1 /*
2  *  - - - - - - - - - - - -
3  *   g a l _ b e b p v 8 7
4  *  - - - - - - - - - - - -
5  *
6  *  This routine is part of the General Astrodynamics Library
7  *
8  *  Description:
9  *
10  *  Earth-Moon Barycentre barycentric position and velocity, with respect to the
11  *  FK5 Reference Frame.
12  *
13  *  Status:
14  *
15  *     internal support routine.
16  *
17  *  Given:
18  *
19  *     tt1                 d            TT epoch part 1 (Note 1)
20  *     tt2                 d            TT epoch part 2 (Note 1)
21  *     ref                 i            Reference frame
22  *                                        0 = dynamical equinox and ecliptic J2000.
23  *                                        1 = FK5 (VSOP87)
24  *
25  *  Returned:
26  *
27  *     pv               d[2][3]         position/velocity (AU, AU/Day)
28  *
29  *  Called:
30  *
31  *     gal_vsop87                       Compute VSOP87 position and velocity
32  *
33  *  Notes:
34  *
35  *  1) The epoch tt1+tt2 is a Julian Date, apportioned in
36  *     any convenient way between the two arguments.  For example,
37  *     JD(TDB)=2450123.7 could be expressed in any of these ways,
38  *     among others:
39  *
40  *               tt1          tt2
41  *
42  *         2450123.7          0.0       (JD method)
43  *         2451545.0      -1421.3       (J2000 method)
44  *         2400000.5      50123.2       (MJD method)
45  *         2450123.5          0.2       (date & time method)
46  *
47  *     The JD method is the most natural and convenient to use in
48  *     cases where the loss of several decimal digits of resolution
49  *     is acceptable.  The J2000 method is best matched to the way
50  *     the argument is handled internally and will deliver the
51  *     optimum resolution.  The MJD method and the date & time methods
52  *     are both good compromises between resolution and convenience.
53  *     However, the accuracy of the result is more likely to be
54  *     limited by the algorithm itself than the way the epoch has been
55  *     expressed.
56  *
57  *  2) On return, the arrays pvh and pvb contain the following:
58  *
59  *        pv[0][0]  x       }
60  *        pv[0][1]  y       } position, AU
61  *        pv[0][2]  z       }
62  *
63  *        pv[1][0]  xdot    }
64  *        pv[1][1]  ydot    } velocity, AU/day
65  *        pv[1][2]  zdot    }
66  *
67  *     The vectors are barycentric with respect to the FK5 Reference Frame.
68  *     The time unit is one day in TT
69  *
70  *  3) The routine is a soution from the planetary theory VSOP87
71  *
72  *  4) The main version of VSOP87 is similar to the previous theory VSOP82.
73  *     In the both cases the constants of integration have been determined by
74  *     fitting to the numerical integration DE200 of the Jet Propulsion Laboratory.
75  *
76  *     The differences between VSOP87 and VSOP82 mainly improve the validity time-span
77  *     for Mercury, Venus, Earth-Moon barycenter and Mars with a precision of 1" for
78  *     4000 years before and after J2000.
79  *     The same precision is ensured for Jupiter and Saturn over 2000 years and for
80  *     Uranus and Neptune over 6000 years before and after J2000.
81  *
82  *     The size of the relative precision p0 of VSOP87 solutions is given hereunder.
83  *     That means that the actual precision is close by p0*a0 au for the distances
84  *     (a0 being the semi-major axis) and close by p0 radian for the other variables.
85  *     By derivation with respect to time expressed in day (d), the precision of the
86  *     velocities is close by p0*a0 au/d for the distances and close by p0 radian/d
87  *     for the other variables.
88  *
89  *     Body          a0 (au)      p0 (10**-8)
90  *     ----          -------      -----------
91  *     Mercury        0.3871          0.6
92  *     Venus          0.7233          2.5
93  *     Earth          1.0000          2.5
94  *     Mars           1.5237         10.0
95  *     Jupiter        5.2026         35.0
96  *     Saturn         9.5547         70.0
97  *     Uranus        19.2181          8.0
98  *     Neptune       30.1096         42.0
99  *
100  *  References:
101  *
102  *     Bretagnon P., Francou G., : 1988, Astron. Astrophys., 202, 309.
103  *
104  *  This revision:
105  *
106  *     2008 June 28
107  *
108  *  Copyright (C) 2008 Paul C. L. Willmott. See notes at end.
109  *
110  *-----------------------------------------------------------------------
111  */
112 
113 #include "gal_bebpv87.h"
114 #include "gal_vsop87.h"
115 #include "gal_bsupv87.h"
116 #include "gal_hebpv87.h"
117 #include "gal_pvppv.h"
118 
119 void
gal_bebpv87(double tt1,double tt2,int ref,double pv[2][3])120 gal_bebpv87
121  (
122     double tt1,
123     double tt2,
124     int ref,
125     double pv[2][3]
126  )
127 
128 {
129 
130   double su[2][3], eb[2][3] ;
131 
132 /*
133  * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
134  */
135 
136 /*
137  * Get Sun barycentric position & velocity
138  */
139 
140   gal_bsupv87 ( tt1, tt2, ref, su ) ;
141 
142 /*
143  * Get Earth-Moon Barycentre heliocentric position & velocity
144  */
145 
146   gal_hebpv87 ( tt1, tt2, ref, eb ) ;
147 
148 /*
149  * Calculate Earth-Moon barycentric position & velocity
150  */
151 
152   gal_pvppv ( eb, su, pv ) ;
153 
154 /*
155  * Finished.
156  */
157 
158 }
159 
160 /*
161  *  gal - General Astrodynamics Library
162  *  Copyright (C) 2008 Paul C. L. Willmott
163  *
164  *  This program is free software; you can redistribute it and/or modify
165  *  it under the terms of the GNU General Public License as published by
166  *  the Free Software Foundation; either version 2 of the License, or
167  *  (at your option) any later version.
168  *
169  *  This program is distributed in the hope that it will be useful,
170  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
171  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
172  *  GNU General Public License for more details.
173  *
174  *  You should have received a copy of the GNU General Public License along
175  *  with this program; if not, write to the Free Software Foundation, Inc.,
176  *  51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
177  *
178  *  Contact:
179  *
180  *  Paul Willmott
181  *  vp9mu@amsat.org
182  */
183