Orbital elements within a gravity simulator problem

In summary, the conversation revolves around a gravity simulator and the challenges of accurately calculating orbital elements and positions of bodies in the system. The issue of using the Earth-moon barycentre versus the primary body for calculations is discussed, as well as potential solutions such as averaging values or changing the time step. The conversation also mentions the use of Horizons for obtaining position and velocity data, and a calculator for converting between orbital elements and position/velocity. Ultimately, the conversation highlights the complexity of accurately simulating celestial bodies and the limitations of current technology.
  • #1
CrLf
4
0
hey everyone

i hope to find the answer to my troubles here :)

basically i have written a gravity simulator, it loads bodies from a file containing information on each body. using the orbital elements on each body taken from nasa's HORIZON system, i calculate the position and velocity of each body to be loaded in the simulator (currently i have data for about 30 bodies, the main planets, moons of jupiter, dwarf planets etc)

and while this system works fine, the positions/velocities are worked out ok, i have trouble converting them back accurately in certain scenarios

the equations i have work properly given the data i feed them (position/velocity) and when for example i work with a 2 body situation of sun and earth, the elements reproduce as expected, a slight change in inclination/perihelion/eccentricity/semimajoraxis as the days tick bye, but this could be attributed to rounding errors, or the fact the initial data was given based on a full-body simulation, not just 2

however my problem comes when i add the moon in. While the interactions between the two are accurate, when i come to recalculate the orbital elements of the earth, they go a little haywire

i know that the moon changes the path of the earth, and as a result it will effect the elements, but unfortunately it changes them too much for me to be able to note over time the gradual change.

the swing happens on all the elements over a period of about 20 days simulator time and is quite annoying :(

i know i could use the earth-moon barycentre to calculate the orbital elements, and that these would remain somewhat more constant, but it isn't a true reflection of the Earth orbit (not to mention the oribtal elements on the horizon site are different for earth/moon barycentre) and then i have the issue of the moons elements with respect to earth, and if i use the earth-moon barycentre this will get annoying when it comes to tracking the movement of the moon away from the Earth once i include tidal forces

the end goal doesn't involve earth/moon but Jupiter and its moons which given the greater number of bodies will compound the problem more

how do i fix this??
should the orbital elements be calculated with respect to the bodies primary body (ie earth-sun, moon-earth) rather than the barycentre of the system, ie earth-sun system barycentre instead of the sun's position
 
Astronomy news on Phys.org
  • #2
come on guys, over 80 views, someone must have an idea :(
 
  • #3
I think you have run into the problem that has plagued astronmers for centuries! Put simply, you would have to calculate the forces acting on every object from every other object at every point in time to be accurate, and that simply isn't really possible. You can only be accurate to a certain degree.
 
  • #4
CrLf said:
2 body situation of sun and earth, the elements reproduce as expected, a slight change in inclination/perihelion/eccentricity/semimajoraxis as the days tick bye
I obviously don't know the specifics of how you programmed this simulation, but none of the four properties you mentioned should change when there are only two bodies being simulated (assuming you are referring to a slight change in the values your simulation produces rather than those values as compared to the ones on the HORIZON site). (except due to rounding error of course)
CrLf said:
i know i could use the earth-moon barycentre to calculate the orbital elements, and that these would remain somewhat more constant, but it isn't a true reflection of the Earth orbit (not to mention the oribtal elements on the horizon site are different for earth/moon barycentre) and then i have the issue of the moons elements with respect to earth, and if i use the earth-moon barycentre this will get annoying when it comes to tracking the movement of the moon away from the Earth once i include tidal forces
Perhaps you could average the values over the course of a month (as determined by the Moon's orbit). Or do a Fourier transform on the output data and subtract the component with the the offending periodicity.
CrLf said:
the swing happens on all the elements over a period of about 20 days simulator time and is quite annoying :(
Have you tried changing the time step/accuracy? If changing the time step (perhaps by 50% or a factor of 2) does not change the phenomenon, it probably is not due to rounding error. In the past I have calculated the total energy of the system at each time step. A periodicity in this (assuming it is not affected by changes in the time step) might indicate an error in the code (of course this is not likely to be practical for large numbers of objects, but for the 2 or 3 you have been modelling so far it shouldn't be too much trouble/require too many computations). Alternatively, the system's total angular momentum should be conserved and easily computable (especially for the 2-body system), so it could be used in a similar way to the energy.
 
  • #5
CrLf said:
...using the orbital elements on each body taken from nasa's HORIZON system, i calculate the position and velocity of each body...

Horizons will give you position and velocity if you ask properly. So no conversion is needed.
If you need to do the conversion, here's a calculator I made to convert between orbital elements and position & velocity.
http://orbitsimulator.com/formulas/OrbitalElements.html

It's a javascript, so you can see the formulas if you view the source.
 
  • #6
hey guys

thx for the responses so far, but none of them combat the issues...

i already work out the forces between each object every iteration, there is no error in the coding or lack of accuracy
the timestep i am currently using is 1 second between calculations (no need for it to run quickly yet) so as you can imagine its pretty accurate

older versions of the sim using the same math ran just as accurately with a timestep of uip to 10000 seconds, but in this one there is more to be added which is more sensitive to the timestep

the initial; position/velocity is fine from the orbital elements, and as i said, with just 2 bodies the program works fine, and reversing the process is correct also

adding the moon changes the orbit of the Earth (as expected) but also reeks havoc on the calculations for the orbital elements, which is my problem here
taking an average won't work, simply because the values i get over a period of ~20 days simply won't give me a real average, nor could i take the specific position at the start of say every year as they don't match up with initial ones as the moons orbit still has the effect
 
  • #7
I don't know much about this, but perhaps steps under a second are more accurate even though from 1-1000 don't change much? I would think that this would become more and more pronounced with the addition of more objects to calculate.
 
  • #8
dude there is no problem with the accuracy of my sim, and don't concern yourself with the timestep, 1second is super accurate, regardless of how many bodies there are

the problem is converting xyz to orbital elements for the Earth when the moon is affecting its orbit, and hence changing the elements from what they should be and are without the moon included.
obviously they calculate it in some manner on NASA site for example and i need to know how
 

1. What are orbital elements?

Orbital elements are parameters that describe the shape, size, and orientation of an orbit. These include the semi-major axis, eccentricity, inclination, longitude of the ascending node, argument of periapsis, and true anomaly.

2. How are orbital elements used in a gravity simulator?

In a gravity simulator, orbital elements are used to calculate the position and velocity of an object in orbit. By inputting the orbital elements into the simulation, the program can accurately model the object's trajectory and motion in relation to other objects in the system.

3. What is the difference between Keplerian and Cartesian orbital elements?

Keplerian orbital elements describe an orbit in terms of its shape and orientation, while Cartesian orbital elements describe an orbit in terms of its position and velocity vectors. Keplerian elements are more commonly used in gravity simulators, as they are easier to work with for elliptical orbits.

4. How do variations in orbital elements affect the orbit?

Changes in orbital elements such as eccentricity and inclination can significantly alter the shape and orientation of an orbit. These changes can lead to variations in the object's speed, distance from the central body, and orbital period.

5. Can orbital elements change over time?

Yes, orbital elements can change over time due to factors such as gravitational perturbations from other objects, atmospheric drag, and tidal forces. These changes can cause the orbit to evolve and eventually result in a different orbital path.

Similar threads

Replies
3
Views
413
  • Astronomy and Astrophysics
Replies
2
Views
2K
Replies
12
Views
2K
  • Astronomy and Astrophysics
Replies
4
Views
2K
Replies
17
Views
2K
  • Astronomy and Astrophysics
Replies
24
Views
1K
  • Astronomy and Astrophysics
Replies
1
Views
426
  • Astronomy and Astrophysics
Replies
9
Views
2K
  • Astronomy and Astrophysics
Replies
33
Views
3K
  • Astronomy and Astrophysics
Replies
5
Views
2K
Back
Top