How Do You Calculate Orbital Dynamics in a Simple Java Simulation?

Click For Summary

Discussion Overview

The discussion revolves around calculating orbital dynamics for a simple Java simulation of the solar system, specifically focusing on the interactions between the Earth and the Sun as they orbit a common center of mass. Participants explore the initial setup, velocity calculations, and the implications of orbital periods.

Discussion Character

  • Exploratory
  • Technical explanation
  • Conceptual clarification
  • Debate/contested

Main Points Raised

  • One participant describes their initial setup with the Earth orbiting a stationary Sun and expresses confusion about transitioning to an orbit around a common center of mass.
  • Another participant suggests that both the Sun and Earth should orbit the center of mass once every 365.2475 days, proposing a formula for calculating the orbital distance.
  • A different participant offers a method for simulating the system by starting with the Sun at rest and allowing both bodies to accelerate according to Newton's law of gravitation, emphasizing the importance of checking the integration procedure.
  • Some participants question the reasoning behind the 365-day orbital period for the Sun, seeking clarification on why it matches the Earth's orbital period.
  • There is a challenge posed regarding the feasibility of maintaining the common center of gravity if the Sun and Earth orbit at different periods.
  • A metaphor is introduced comparing the orbital dynamics to a dance, illustrating the relationship between the orbital periods of two bodies of differing masses.

Areas of Agreement / Disagreement

Participants express differing views on the implications of orbital periods and the mechanics of maintaining a common center of mass, indicating that the discussion remains unresolved with multiple competing perspectives.

Contextual Notes

Participants have not fully resolved the assumptions regarding the relationship between the orbital periods of the Sun and Earth, nor the implications of their differing masses on the center of mass calculations.

whatisreality
Messages
286
Reaction score
1
I'm an undergrad (so my simulation is VERY simple), writing a java program to simulate the solar system. And I'm a bit stuck on how to calculate a couple of important things.

I'm literally right at the start of this, with just a sun and an earth. Initially I had my Earth going round my stationary sun in circles. It worked fine, in the sense that after a year the Earth was back where it started - or the same distance away at least.

Now I've tried to get the Earth and sun to orbit a common centre of mass. This has not worked. It was fairly easy to work out where their centre of mass is, and adjust their initial positions so that the centre of mass is at the origin.
Now it's occurred to me that I don't know what their velocities relative to this centre of mass are. Will Earth's velocity be its orbital velocity? How do I find the velocity of the sun about this common centre of mass? Will the centre of mass stay in the same place?

Thanks for any help!
 
Physics news on Phys.org
Both the sun and the Earth need to orbit that point once every 365.2475 days. So 2πR / 365.2475 days.
 
There are several ways to do this.

One simple way is to start with the sun at rest at the origin, just like you did before, but now let all bodies (Sun and Earth) accelerate according to Newtons law of gravitation. If you then calculate the center of mass and plot it over time you should see the center of mass move in a straight line to within your error of integration. If it does, you can now simply plot the orbit of the bodies relative to the center of mass. If it doesn't, you know you should check your integration procedure.

If you want to start with center of mass in the origin and (hopefully) not moving (as you asked for), then from the position and velocity of all bodies relative to the Sun you can calculate the position and velocity of the center of mass (if you don't know how to do this then please write up the equation for center of mass and ask specific questions where you get stuck). You can now just subtract the position and velocity of the center of mass from all other velocities (including the Sun) before you start integration. Now you should observe that the center of mass stays at the origin. Any (accumulated) error in integration will be even more apparent in this case if the center of mass starts to gain a velocity that do no average to zero.
 
.Scott said:
Both the sun and the Earth need to orbit that point once every 365.2475 days. So 2πR / 365.2475 days.
Why 365 days? I know it's an Earth year obviously, but it's not obvious to me why that should also be the sun's orbital period about this point.
 
How are you going to keep the common center of gravity in the same place if they orbit at different periods?
 
whatisreality said:
Why 365 days? I know it's an Earth year obviously, but it's not obvious to me why that should also be the sun's orbital period about this point.
Imagine a very large man and a very small woman, arms locked together, pirouetting around each other on a dance floor. If she orbits him once every second, how often will he have to orbit her?
 

Similar threads

  • · Replies 7 ·
Replies
7
Views
3K
Replies
18
Views
3K
  • · Replies 11 ·
Replies
11
Views
2K
  • · Replies 15 ·
Replies
15
Views
2K
  • · Replies 2 ·
Replies
2
Views
3K
  • · Replies 10 ·
Replies
10
Views
2K
  • · Replies 2 ·
Replies
2
Views
4K
  • · Replies 12 ·
Replies
12
Views
2K
  • · Replies 122 ·
5
Replies
122
Views
9K
  • · Replies 19 ·
Replies
19
Views
3K