Using iteration to orbit dual suns - losing energy

  • Context: Graduate 
  • Thread starter Thread starter Rapidrain
  • Start date Start date
  • Tags Tags
    Dual Energy Orbit
Click For Summary

Discussion Overview

The discussion revolves around the challenges of maintaining constant total energy (TE) in a simulation of a satellite orbiting dual gravity sources using iterative methods. Participants explore various approaches to correct energy loss during iterations, considering different methods of adjusting kinetic and potential energy.

Discussion Character

  • Exploratory, Technical explanation, Debate/contested, Mathematical reasoning

Main Points Raised

  • One participant describes a scenario where total energy decreases over iterations and proposes several methods to compensate for this loss, including adjusting kinetic energy (KE), potential energy (PE), or a combination of both.
  • Another participant inquires about the specific method used for iterations and the tracking of errors, highlighting the complexity of adjusting velocity and position.
  • A participant mentions using the semi-implicit Euler method for calculations, detailing the process of updating position and velocity using two-dimensional vectors.
  • Concerns are raised about the expectation of increased accuracy with higher speeds, with one participant noting that attempts to increase speed led to greater inaccuracies instead.
  • Suggestions are made to test different integration methods and to consider reducing the number of iterations or using smaller time steps to stabilize total energy.
  • One participant asserts that reducing iterations does not resolve the issue of energy loss, while smaller time steps slow the rate of energy decrease but do not solve the underlying problem.
  • There is mention of exploring the Runge-Kutta method as a potential alternative for improving accuracy.

Areas of Agreement / Disagreement

Participants express differing opinions on the effectiveness of various methods to maintain constant total energy. Some suggest reducing iterations or changing integration methods, while others argue that these approaches have not yielded the desired results. The discussion remains unresolved regarding the best approach to address the energy loss issue.

Contextual Notes

Participants note that the energy calculation method remains consistent, but the accuracy of the iteration algorithm is questioned. There is also uncertainty regarding the impact of different time steps and the choice of integration methods on the stability of total energy.

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: 505
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: 523
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
 

Similar threads

  • · Replies 6 ·
Replies
6
Views
3K
Replies
3
Views
10K
  • · Replies 7 ·
Replies
7
Views
6K
  • · Replies 9 ·
Replies
9
Views
4K
Replies
5
Views
3K
Replies
17
Views
4K
  • · Replies 1 ·
Replies
1
Views
2K
  • · Replies 7 ·
Replies
7
Views
2K
  • · Replies 8 ·
Replies
8
Views
8K
  • · Replies 16 ·
Replies
16
Views
12K