Dismiss Notice
Join Physics Forums Today!
The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

Using iteration to orbit dual suns - losing energy

  1. Aug 1, 2012 #1
    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.
     

    Attached Files:

  2. jcsd
  3. Aug 1, 2012 #2

    mfb

    User Avatar
    2016 Award

    Staff: Mentor

    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?
     
  4. Aug 1, 2012 #3
    >>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 [Broken]

    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.
     

    Attached Files:

    Last edited by a moderator: May 6, 2017
  5. Aug 1, 2012 #4

    mfb

    User Avatar
    2016 Award

    Staff: Mentor

    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?
     
  6. Aug 2, 2012 #5
    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.
     
  7. Aug 2, 2012 #6
    >>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
     
Know someone interested in this topic? Share this thread via Reddit, Google+, Twitter, or Facebook




Similar Discussions: Using iteration to orbit dual suns - losing energy
  1. Earth, Sun, Moon Orbit (Replies: 26)

  2. Sun orbital scanner (Replies: 7)

Loading...