source: trunk/MagicSoft/slalib/ue2el.c@ 18105

Last change on this file since 18105 was 732, checked in by tbretz, 24 years ago
*** empty log message ***
  • Property svn:executable set to *
File size: 7.5 KB
Line 
1#include "slalib.h"
2#include "slamac.h"
3void slaUe2el ( double u[], int jformr,
4 int *jform, double *epoch, double *orbinc,
5 double *anode, double *perih, double *aorq, double *e,
6 double *aorl, double *dm, int *jstat )
7/*
8** - - - - - - - - -
9** s l a U e 2 e l
10** - - - - - - - - -
11**
12** Transform universal elements into conventional heliocentric
13** osculating elements.
14**
15** Given:
16**
17** u double[13] universal orbital elements (Note 1)
18**
19** [0] combined mass (M+m)
20** [1] total energy of the orbit (alpha)
21** [2] reference (osculating) epoch (t0)
22** [3-5] position at reference epoch (r0)
23** [6-8] velocity at reference epoch (v0)
24** [9] heliocentric distance at reference epoch
25** [10] r0.v0
26** [11] date (t)
27** [12] universal eccentric anomaly (psi) of date, approx
28**
29** jformr int requested element set (1-3; Note 3)
30**
31** Returned:
32** jform double* element set actually returned (1-3; Note 4)
33** epoch double* epoch of elements (TT MJD)
34** orbinc double* inclination (radians)
35** anode double* longitude of the ascending node (radians)
36** perih double* longitude or argument of perihelion (radians)
37** aorq double* mean distance or perihelion distance (AU)
38** e double* eccentricity
39** aorl double* mean anomaly or longitude (radians, jform=1,2 only)
40** dm double* daily motion (radians, jform=1 only)
41** jstat int* status: 0 = OK
42** -1 = illegal combined mass
43** -2 = illegal jformr
44** -3 = position/velocity out of range
45**
46** Notes
47**
48** 1 The "universal" elements are those which define the orbit for the
49** purposes of the method of universal variables (see reference 2).
50** They consist of the combined mass of the two bodies, an epoch,
51** and the position and velocity vectors (arbitrary reference frame)
52** at that epoch. The parameter set used here includes also various
53** quantities that can, in fact, be derived from the other
54** information. This approach is taken to avoiding unnecessary
55** computation and loss of accuracy. The supplementary quantities
56** are (i) alpha, which is proportional to the total energy of the
57** orbit, (ii) the heliocentric distance at epoch, (iii) the
58** outwards component of the velocity at the given epoch, (iv) an
59** estimate of psi, the "universal eccentric anomaly" at a given
60** date and (v) that date.
61**
62** 2 The universal elements are with respect to the mean equator and
63** equinox of epoch J2000. The orbital elements produced are with
64** respect to the J2000 ecliptic and mean equinox.
65**
66** 3 Three different element-format options are supported:
67**
68** Option jform=1, suitable for the major planets:
69**
70** epoch = epoch of elements (TT MJD)
71** orbinc = inclination i (radians)
72** anode = longitude of the ascending node, big omega (radians)
73** perih = longitude of perihelion, curly pi (radians)
74** aorq = mean distance, a (AU)
75** e = eccentricity, e
76** aorl = mean longitude L (radians)
77** dm = daily motion (radians)
78**
79** Option jform=2, suitable for minor planets:
80**
81** epoch = epoch of elements (TT MJD)
82** orbinc = inclination i (radians)
83** anode = longitude of the ascending node, big omega (radians)
84** perih = argument of perihelion, little omega (radians)
85** aorq = mean distance, a (AU)
86** e = eccentricity, e
87** aorl = mean anomaly M (radians)
88**
89** Option jform=3, suitable for comets:
90**
91** epoch = epoch of perihelion (TT MJD)
92** orbinc = inclination i (radians)
93** anode = longitude of the ascending node, big omega (radians)
94** perih = argument of perihelion, little omega (radians)
95** aorq = perihelion distance, q (AU)
96** e = eccentricity, e
97**
98** 4 It may not be possible to generate elements in the form
99** requested through jformr. The caller is notified of the form
100** of elements actually returned by means of the jform argument:
101**
102** jformr jform meaning
103**
104** 1 1 OK - elements are in the requested format
105** 1 2 never happens
106** 1 3 orbit not elliptical
107**
108** 2 1 never happens
109** 2 2 OK - elements are in the requested format
110** 2 3 orbit not elliptical
111**
112** 3 1 never happens
113** 3 2 never happens
114** 3 3 OK - elements are in the requested format
115**
116** 5 The arguments returned for each value of jform (cf Note 6: jform
117** may not be the same as jformr) are as follows:
118**
119** jform 1 2 3
120** epoch t0 t0 T
121** orbinc i i i
122** anode Omega Omega Omega
123** perih curly pi omega omega
124** aorq a a q
125** e e e e
126** aorl L M -
127** dm n - -
128**
129** where:
130**
131** t0 is the epoch of the elements (MJD, TT)
132** T " epoch of perihelion (MJD, TT)
133** i " inclination (radians)
134** Omega " longitude of the ascending node (radians)
135** curly pi " longitude of perihelion (radians)
136** omega " argument of perihelion (radians)
137** a " mean distance (AU)
138** q " perihelion distance (AU)
139** e " eccentricity
140** L " longitude (radians, 0-2pi)
141** M " mean anomaly (radians, 0-2pi)
142** n " daily motion (radians)
143** - means no value is set
144**
145** 6 At very small inclinations, the longitude of the ascending node
146** anode becomes indeterminate and under some circumstances may be
147** set arbitrarily to zero. Similarly, if the orbit is close to
148** circular, the true anomaly becomes indeterminate and under some
149** circumstances may be set arbitrarily to zero. In such cases,
150** the other elements are automatically adjusted to compensate,
151** and so the elements remain a valid description of the orbit.
152**
153** References:
154**
155** 1 Sterne, Theodore E., "An Introduction to Celestial Mechanics",
156** Interscience Publishers Inc., 1960. Section 6.7, p199.
157**
158** 2 Everhart, E. & Pitkin, E.T., Am.J.Phys. 51, 712, 1983.
159**
160** Called: slaPv2el
161**
162** Last revision: 18 March 1999
163**
164** Copyright P.T.Wallace. All rights reserved.
165*/
166
167/* Gaussian gravitational constant (exact) */
168#define GCON 0.01720209895
169
170/* Canonical days to seconds */
171#define CD2S ( GCON / 86400.0 )
172
173{
174 int i;
175 double pmass, date, pv[6];
176
177
178/* Unpack the universal elements. */
179 pmass = u[0] - 1.0;
180 date = u[2];
181 for ( i = 0; i < 3; i++ ) {
182 pv[i] = u[i+3];
183 pv[i+3] = u[i+6] * CD2S;
184 }
185
186/* Convert the position and velocity etc into conventional elements. */
187 slaPv2el ( pv, date, pmass, jformr, jform, epoch, orbinc, anode,
188 perih, aorq, e, aorl, dm, jstat );
189
190}
Note: See TracBrowser for help on using the repository browser.