Using iteration to orbit dual suns - losing energy

AI Thread Summary
A satellite is being simulated to orbit dual gravity sources, but total energy (TE) decreases with each iteration, necessitating corrections. The user considers various methods to compensate for energy loss, including adjusting kinetic energy (KE) or potential energy (PE), but finds that increasing speed leads to greater inaccuracies. They utilize a semi-implicit method for calculations and observe discrepancies in expected positions after multiple iterations. Suggestions include reducing the number of iterations or exploring alternative integration methods like Runge-Kutta for improved accuracy. The discussion highlights the challenges of maintaining energy consistency in iterative simulations.
Rapidrain
Messages
31
Reaction score
0
Using iteration I've got a satellite flying around two gravity sources. (See picture)

When using the iteration over a 100 times I see that TE, total energy slowly sinks so I need to make a correction after each iteration to insure that TE is constant.

Trouble is I have several possibilities :

Example : at the start I have :
PE = -100 KE = 125 => TE = 25

after one iteration I have TE = 20 (a quite exaggerated difference in this example)
I have lost 5 Joules.

to compensate :
A should I increase the KE by 5, increasing the magnitude of the velocity by sqrt(5)?

B should I increase the PE by moving the satellite a bit farther away from the GS bodies?

C should I split the difference evenly? Each should compensate 2.5 Joules.

D should I split the different 4:5 or 5:4 due to the different sizes of PE and KE?

Maybe I need a Math professor for this one.
 

Attachments

  • Two Gravity Sources.jpg
    Two Gravity Sources.jpg
    13.6 KB · Views: 485
Astronomy news on Phys.org
Which method do you use to calculate your iterations?
Can you track where the error comes from?

Increasing the velocity can be tricky - add velocity in which direction? In the same way, shift the body in which direction?
 
>>Which method do you use to calculate your iterations?

I found by way of another entry in this forum a link to a site where
'Euler Implicit' and 'Euler Explicit' and 'Euler Semi-Implici' were described

http://www.physics.udel.edu/~jim/Ordinary%20Differential%20Equations/The%20Implicit%20Euler%20Method.pdf

http://web.mit.edu/10.001/Web/Course_Notes/Differential_Equations_Notes/node3.html

http://en.wikipedia.org/wiki/Semi-implicit_Euler_method

I use the semi-implicit method so :
where I first calc the position :

newPos = oldPOs + time*oldVelocity

Then I use the old velocity and new accelleration to find the new velocity.
All done with 2 dimensional vectors.

newVel = oldVel + time*newAccelleration

the websites said p(k+1) = p(k) + time*v(k)
v(k+1) = v(k) + time*acc(k+1)

>>Increasing the velocity can be tricky - add velocity in which direction? In the same way, shift the body in which direction?

I do not alter the direction in any way, just multiply the scaler value of the magnitude of the vecotr.

In the picture I put one gravity source at a position and got (not using iteration) a beautiful ellipse. However I take two gravity sources and place them each at the same position (each with half the original mass) and when using iteration I expect the same curve.

A point at the top at Y = 380.0 should be met after 198 iterations. I always come to it in this example at 379.5.

Now the punchline : when I try to get more accuracy by increasing the speed and thereby increasing KE by the amount of energy it loses in TE in each iteration,
then the inaccuracy increases to 383.7 ! instead of 380.0.

My attempt to increase accuracy has decreased accuracy.
 

Attachments

  • Perfect Ellipse.jpg
    Perfect Ellipse.jpg
    19.9 KB · Views: 502
Last edited by a moderator:
Why do you expect more accuracy with increased speed? Do you get a better accuracy with a reduced time step?
Maybe you can test other integration methods.

Did you try A or B? Do they help?
 
Rapidrain said:
When using the iteration over a 100 times I see that TE, total energy slowly sinks so I need to make a correction after each iteration to insure that TE is constant.

What you really need to do is

1) reduce the number of iterations so that the TE is constant
2) If 1) doesn't work consider using another differencing scheme (i.e. Runga-Kutta)

Adding things post-hoc to get the numerics to work usually ends up not working very well.

Also, one thing to do is to try to look at the energy with smaller time steps. If you use small time steps and your energy is still going down at the same rate, then this isn't an issue with the difference scheme. It could be a bug in the way that energy is being calculated.
 
>>1) reduce the number of iterations so that the TE is constant

Reducing the number of iterations does not cause the TE to become constant.

>>Also, one thing to do is to try to look at the energy with smaller time steps.

Smaller times steps = increasing number of iterations.

Done that, the TE rate of change becomes less, goes down at a slower rate,

but I am looking for an iteration algorithm which is more accurate.

>>It could be a bug in the way that energy is being calculated.

The energy is calculated in the same manner, always.

*****************

I'll look into Runga-Kutta
 
TL;DR Summary: In 3 years, the Square Kilometre Array (SKA) telescope (or rather, a system of telescopes) should be put into operation. In case of failure to detect alien signals, it will further expand the radius of the so-called silence (or rather, radio silence) of the Universe. Is there any sense in this or is blissful ignorance better? In 3 years, the Square Kilometre Array (SKA) telescope (or rather, a system of telescopes) should be put into operation. In case of failure to detect...
Thread 'Could gamma-ray bursts have an intragalactic origin?'
This is indirectly evidenced by a map of the distribution of gamma-ray bursts in the night sky, made in the form of an elongated globe. And also the weakening of gamma radiation by the disk and the center of the Milky Way, which leads to anisotropy in the possibilities of observing gamma-ray bursts. My line of reasoning is as follows: 1. Gamma radiation should be absorbed to some extent by dust and other components of the interstellar medium. As a result, with an extragalactic origin, fewer...
This thread is dedicated to the beauty and awesomeness of our Universe. If you feel like it, please share video clips and photos (or nice animations) of space and objects in space in this thread. Your posts, clips and photos may by all means include scientific information; that does not make it less beautiful to me (n.b. the posts must of course comply with the PF guidelines, i.e. regarding science, only mainstream science is allowed, fringe/pseudoscience is not allowed). n.b. I start this...
Back
Top