Question about Numerical Integration?

ncc1701d

Member
Joined
Aug 9, 2009
Messages
204
Reaction score
6
Points
18
Hello,
Lets say I have a partial orbit curve in space. I know how to construct the curve. I have, for example, 500 X Y Z coordinates for the points that make up the orbit curve so its pretty smooth. Those X Y Z coordinates are referenced to the planet with x axis pointing in the direction of the sun already accounting for the fact the sun may move. Next I have only 13 points on that orbit curve spaced apart at various distances from each other. For each of those 13 points I have a time as in the form of minutes relative to the first of those 13 points. The location of those 13 points is accurate. Is there a way to fill in other times along the orbit curve? Hope this make sense? Can I use Numerical Integration for this? If so what type of method? Any ideas how to solve this problem? What I want are more than just the 13 points on the curve.
thanks Hope this makes sense.
 

MontBlanc2012

Active member
Joined
Aug 13, 2017
Messages
138
Reaction score
26
Points
28
Hi, 'ncc1701d'

The short answer is yes, you would use a form of numerical integration. To describe a particular method, it would be helpful to have answers to the following:

Is your gravity field a straight-forward Keplerian (1/r^2) gravity field or does it have solar and other perturbations (and are those perturbations significant)?

And do you have the velocity vectors at each of your 13 points in addition to the XYZ position vectors?
 

Thorsten

Active member
Joined
Dec 7, 2013
Messages
785
Reaction score
56
Points
43
(I assume you're fine with an approximate answer - in general if you want the real accurate answer you have to solve the full problem with gravitational potentials)

If you know the function that connects the curve (an unperturbed closed orbit for instance would be nearly an ellipse) you can simply fit that function to the points and use Kepler's laws to reconstruct the timing.

Otherwise Spline Interpolation will probably give you a fast and reasonably accurate interpolation method.
 

MontBlanc2012

Active member
Joined
Aug 13, 2017
Messages
138
Reaction score
26
Points
28
As per Thorsten, spline interpolation will work just fine as an approximate solution.

Having said that, a somewhat less approximate approach is to use a Lambert Solver to determine the exact shape of the Keplerian (1/r^2) trajectory between each consecutive pair of your 13 points. Then one can use what is known as a Propagator to work out any point between these point pairs. These calculations are accurate so long as gravitational perturbations can be ignored (which, for the most part, they usually can).

Lambert Solvers and Propagators are available as 'off-the-shelf' Python and/or C programs and are both accurate and fast.

If perturbations are significant, and accuracy isn't important, then a straightforward spline interpolation is just fine. If accuracy is important and there aren't major gravitational perturbations, then the solution to your problem becomes more complicated.
 
Last edited:

ncc1701d

Member
Joined
Aug 9, 2009
Messages
204
Reaction score
6
Points
18
to MontBlanc2012
Is your gravity field a straight-forward Keplerian (1/r^2) gravity field or does it have solar and other perturbations (and are those perturbations significant)?

Answer:The orbit is for an approach and flyby around Venus so to what degree perturbations are significant I dont know. I dont know if the gravity field is straight forward Keplerian or not but I am looking for best realism if I can. What are the other gravity fields should I worry about?

And do you have the velocity vectors at each of your 13 points in addition to the XYZ position vectors? No I do not have velocity vectors.

The answers provided so far by everyone I have to research more. I have never done this kind of math before. I may ask more questions after I study some of your guys solutions and experiment.

---------- Post added at 06:21 PM ---------- Previous post was at 06:16 PM ----------

Do you guys know what a "simple second order polynomial" is ? and do you think that would help me in some way?
 

martins

Orbiter Founder
Orbiter Founder
Joined
Mar 31, 2008
Messages
2,448
Reaction score
462
Points
83
Website
orbit.medphys.ucl.ac.uk
The orbit is for an approach and flyby around Venus so to what degree perturbations are significant I dont know. I dont know if the gravity field is straight forward Keplerian or not but I am looking for best realism if I can. What are the other gravity fields should I worry about?

This sounds like you cannot ignore the orbit perturbations, since you are moving from a heliocentric orbit during approach to a Venus-centric orbit during flyby, so this cannot be described by a single Keplerian 2-body orbit (unless you are only interested in a small section of that orbit that is dominated by one or the other celestial body). You need a slightly more sophisticated model, e.g. a patched approach (stitching together two separate 2-body orbits), or a fully dynamic approach using numerical integration to propagate the orbit.

Setting up such a model yourself is not trivial, but there should be plenty around. In the first instance you could even use Orbiter, although if you need high accuracy it won't be the first choice, and the graphics overhead only gets in the way.

Once you have got your forward model (call it x(t) = F(x0, t), where x0 is a state vector at some initial time t0, t is the time you propagate to, and x(t) is the propagated state), what you are left with is a fairly straightforward inverse problem of finding the initial state x0 that best fits the control points when propagated.

In other words, you need to find x0 that minimises an objective function, e.g.

D(x0) = sum_i ||M_i - F(x0,t_i)||^2

where M_i are your position control points at times t_i.

Note that you already have half of the x0 = (r0,v0) you are looking for (the position r0 of your initial sample), so you only need to find the velocity part v0 of x0. So the solution space has only 3 dimensions which is quite benign as inverse problems go (it would be harder if you also needed to factor in an engine burn to fit to a target outbound trajectory).

How can you solve the problem? The easiest (naive) approach would be to just randomly try different values for v0. A better approach would be a Markov chain method where you take a random step from the current sample and accept the new sample depending on its objective value with a given probability distribution, and thereby map out the solution space around the minimum. Or you could use a gradient-based method (e.g. steepest descent, conjugate gradients, etc.). However this requires to calculate the derivative of D with respect to x. Depending on your choice of F, an analytic expression of the gradient may not exist, so you would have to approximate with a finite difference (perturb x slightly and calculate the change of D). A sensible starting point for x0 would be the approximate solution from an unperturbed orbit (e.g. as calculated with a Lambert solver from the first two control points).

Once you found the optimal x0, you can find any point of the orbit by running the forward model, not just between the control points, but also beyond them (although how far you can sensibly extrapolate depends on the accuracy of the model and the observations).

Anyway, welcome in the exciting world of inverse problems! :tiphat:
 

MontBlanc2012

Active member
Joined
Aug 13, 2017
Messages
138
Reaction score
26
Points
28
Further to 'martins' comments, the fact that you are approaching and flyby of Venus means that your gravity field is not Keplerian. This makes life more complicated.

By far, the easier way to tackle this is to use what is known as a 'patched conics approximation' where you break up your points into those that are 'a long way from the Venus' and those that are 'close to Venus'. For the first set, you assume that the Sun is the only gravitating source (i.e., a nice simple Keplerian gravity field) and you ignore Venus' gravity entirely; and for the second set you assume that Venus is the only gravitating source (i.e., also a nice, simple Keplerian gravity field) and ignore the Sun's gravity entirely. In both cases, you can use a standard 'off-the-shelf' Lambert Solver and forward propagator to calculate the trajectory arcs between the points. This approach isn't perfect, particularly at the boundary of being 'close to Venus' and 'far from Venus', but it does provide a very good and useful approximation to the 'true' trajectory solution: after all, it's basically the one that TransX in Orbiter 2016 uses, for example, and with it people on this Forum regularly design and execute flyby trajectories throughout the Solar System.

The harder way is to use a full (restricted) three-body model (Sun, Venus and vessel) to calculate the trajectory arcs. Going down this road is much akin to diving off the mathematical deep-end and may not be the best place to start. Having said that, there are plenty of people in this Forum who have the expertise to help - but you will need to prepare yourself for a rather steep learning curve.

wrt "simple second order polynomial": this is basically a function that looks like

y = a * x^2 + b * x + c

In comparison, a straight-line (aka a 'simple first order polynomial) looks like:

y = a * x + b

Would this help? Second order polynomials are key parts of the basic mathematical toolkit for physicists, engineers and the like - much like a hammer, screwdriver or a wrench might be for others. They are simple, practical and versatile things that can be adapted and applied to a wide variety of problems. And if one had no other tools at one's disposal, one might resort to using them. In your case, however, there are better, more specialist tools available - so using second order polynomials wouldn't be my first choice in this case.
 

ncc1701d

Member
Joined
Aug 9, 2009
Messages
204
Reaction score
6
Points
18
This paper covers what they did to recreate the trajectory files for Mariner 6 and 7.

http://pds-geosciences.wustl.edu/ma...xbury_pdart14_mariner69/document/mr69_bsp.pdf

It seems they also only had position and dates for times when pictures were taken and then recreated the trajectory from them.
I thought I might be able to use the same method they did. They have many more points or spacecraft positions to start with than me though.
If you read that pdf does it suggest to you any ideas for me?

I know how to use SPICE so thats not my worry.

The particular quote that interested me was page 4. under "3 S (.bsp) Kernels."
" The Mariner 6 and 7 position and velocities at encounter
were also transformed and were used as initial conditions, together with the latest IAU
Mars orientation frame, gravity field and the planetary ephemerides, ""to numerically integrate the
N-body equations of motion and variational equations"". The initial encounter positions and velocities
were adjusted to minimize the difference between the positions derived from Campbell,
1970 and the position extracted from the integrated trajectories"
 
Last edited:

MontBlanc2012

Active member
Joined
Aug 13, 2017
Messages
138
Reaction score
26
Points
28
Hi, 'ncc1701d'

The method used in the paper basically uses a complicated n-body numerical integration scheme to construct the perturbed Lambert solver.

OK, so what dos this mean? Well, the paper's authors use a complex gravity model where they throw in as much detail as they can about the gravitation contributions of every massive body in the Solar System that they can think of - including, I expect various perturbations due to General Relativity. Then, they use the approach outline by 'martins' to find the trajectory that 'connects the dots', so to speak. Clearly, the authors are aiming for as high a precision in these calculations as they possibly can.

To apply this technique to your problem, you would need to:

1. convert your 13 (or however many) points to the SPICE reference frame (presumably J2000);

2. use a simple, patched conic approximation to solve the trajectory problem approximately and to provide a starting solution for an n-body refinement;

3. build a detailed n-body gravity model for the Solar System (with or without General Relativity contributions - depending on the level of precision you are aiming for). Position of gravity bodies to be based on SPICE data.

4. starting from the approximate solution, use the n-body gravity model to produce a highly accurate trajectory estimate. This would proceed roughly along the lines of 'martins' outline approach (see earlier post) - but it basically proceeds by a systematic means of trial and error.

If you have all of these tools to hand, it isn't an enormous challenge. In fact, on occasion, I've done something similar to calculate precision intercept trajectories in the past. But if you don't have all of these things in place, it can be quite an uphill climb.
 
Last edited:

Thorsten

Active member
Joined
Dec 7, 2013
Messages
785
Reaction score
56
Points
43
Ah, if only people would describe this problem properly up-front :)

Yes, I completely agree with MontBlanc2012 - that's the thing you have to do if you're interested in high accuracy.
 
Top