FACT++  1.0
void palEl2ue ( double  date,
int  jform,
double  epoch,
double  orbinc,
double  anode,
double  perih,
double  aorq,
double  e,
double  aorl,
double  dm,
double  u[13],
int *  jstat 
)

Definition at line 178 of file palEl2ue.c.

References PAL__GCON, palPv2ue(), and palUe2pv().

Referenced by palPertel(), palPlanel(), palPlante(), and t_planet().

180  {
181 
182  /* Sin and cos of J2000 mean obliquity (IAU 1976) */
183  const double SE=0.3977771559319137;
184  const double CE=0.9174820620691818;
185 
186  int J;
187 
188  double PHT,ARGPH,Q,W,CM,ALPHA,PHS,SW,CW,SI,CI,SO,CO,
189  X,Y,Z,PX,PY,PZ,VX,VY,VZ,DT,FC,FP,PSI,
190  UL[13],PV[6];
191 
192  /* Validate arguments. */
193  if (jform < 1 || jform > 3) {
194  *jstat = -1;
195  return;
196  }
197  if (e < 0.0 || e > 10.0 || (e >= 1.0 && jform != 3)) {
198  *jstat = -2;
199  return;
200  }
201  if (aorq <= 0.0) {
202  *jstat = -3;
203  return;
204  }
205  if (jform == 1 && dm <= 0.0) {
206  *jstat = -4;
207  return;
208  }
209 
210  /*
211  * Transform elements into standard form:
212  *
213  * PHT = epoch of perihelion passage
214  * ARGPH = argument of perihelion (little omega)
215  * Q = perihelion distance (q)
216  * CM = combined mass, M+m (mu)
217  */
218 
219  if (jform == 1) {
220 
221  /* Major planet. */
222  PHT = epoch-(aorl-perih)/dm;
223  ARGPH = perih-anode;
224  Q = aorq*(1.0-e);
225  W = dm/PAL__GCON;
226  CM = W*W*aorq*aorq*aorq;
227 
228  } else if (jform == 2) {
229 
230  /* Minor planet. */
231  PHT = epoch-aorl*sqrt(aorq*aorq*aorq)/PAL__GCON;
232  ARGPH = perih;
233  Q = aorq*(1.0-e);
234  CM = 1.0;
235 
236  } else {
237 
238  /* Comet. */
239  PHT = epoch;
240  ARGPH = perih;
241  Q = aorq;
242  CM = 1.0;
243 
244  }
245 
246  /* The universal variable alpha. This is proportional to the total
247  * energy of the orbit: -ve for an ellipse, zero for a parabola,
248  * +ve for a hyperbola. */
249 
250  ALPHA = CM*(e-1.0)/Q;
251 
252  /* Speed at perihelion. */
253 
254  PHS = sqrt(ALPHA+2.0*CM/Q);
255 
256  /* In a Cartesian coordinate system which has the x-axis pointing
257  * to perihelion and the z-axis normal to the orbit (such that the
258  * object orbits counter-clockwise as seen from +ve z), the
259  * perihelion position and velocity vectors are:
260  *
261  * position [Q,0,0]
262  * velocity [0,PHS,0]
263  *
264  * To express the results in J2000 equatorial coordinates we make a
265  * series of four rotations of the Cartesian axes:
266  *
267  * axis Euler angle
268  *
269  * 1 z argument of perihelion (little omega)
270  * 2 x inclination (i)
271  * 3 z longitude of the ascending node (big omega)
272  * 4 x J2000 obliquity (epsilon)
273  *
274  * In each case the rotation is clockwise as seen from the +ve end of
275  * the axis concerned.
276  */
277 
278  /* Functions of the Euler angles. */
279  SW = sin(ARGPH);
280  CW = cos(ARGPH);
281  SI = sin(orbinc);
282  CI = cos(orbinc);
283  SO = sin(anode);
284  CO = cos(anode);
285 
286  /* Position at perihelion (AU). */
287  X = Q*CW;
288  Y = Q*SW;
289  Z = Y*SI;
290  Y = Y*CI;
291  PX = X*CO-Y*SO;
292  Y = X*SO+Y*CO;
293  PY = Y*CE-Z*SE;
294  PZ = Y*SE+Z*CE;
295 
296  /* Velocity at perihelion (AU per canonical day). */
297  X = -PHS*SW;
298  Y = PHS*CW;
299  Z = Y*SI;
300  Y = Y*CI;
301  VX = X*CO-Y*SO;
302  Y = X*SO+Y*CO;
303  VY = Y*CE-Z*SE;
304  VZ = Y*SE+Z*CE;
305 
306  /* Time from perihelion to date (in Canonical Days: a canonical day
307  * is 58.1324409... days, defined as 1/PAL__GCON). */
308 
309  DT = (date-PHT)*PAL__GCON;
310 
311  /* First approximation to the Universal Eccentric Anomaly, PSI,
312  * based on the circle (FC) and parabola (FP) values. */
313 
314  FC = DT/Q;
315  W = pow(3.0*DT+sqrt(9.0*DT*DT+8.0*Q*Q*Q), 1.0/3.0);
316  FP = W-2.0*Q/W;
317  PSI = (1.0-e)*FC+e*FP;
318 
319  /* Assemble local copy of element set. */
320  UL[0] = CM;
321  UL[1] = ALPHA;
322  UL[2] = PHT;
323  UL[3] = PX;
324  UL[4] = PY;
325  UL[5] = PZ;
326  UL[6] = VX;
327  UL[7] = VY;
328  UL[8] = VZ;
329  UL[9] = Q;
330  UL[10] = 0.0;
331  UL[11] = date;
332  UL[12] = PSI;
333 
334  /* Predict position+velocity at epoch of osculation. */
335  palUe2pv( date, UL, PV, &J );
336  if (J != 0) {
337  *jstat = -5;
338  return;
339  }
340 
341  /* Convert back to universal elements. */
342  palPv2ue( PV, date, CM-1.0, u, &J );
343  if (J != 0) {
344  *jstat = -5;
345  return;
346  }
347 
348  /* OK exit. */
349  *jstat = 0;
350 
351 }
void palPv2ue(const double pv[6], double date, double pmass, double u[13], int *jstat)
Definition: palPv2ue.c:114
static const double PAL__GCON
Definition: palmac.h:117
void palUe2pv(double date, double u[13], double pv[], int *jstat)

+ Here is the call graph for this function:

+ Here is the caller graph for this function: