Solar System simulator

Got a question on astronomy that you'd wanted to ask? Ask your questions here and see if the old timers can give you some good answers.
Post Reply
ChaosKnight
Posts: 293
Joined: Sun Oct 05, 2003 6:54 pm

Solar System simulator

Post by ChaosKnight »

Images from a computer program i wrote to simulate 9 planets and 1 sun.
All planets are initialized on the horizontal axis with respective distances and velocities.

Orbital paths of first 8 planets:
Image

Orbital path of Mercury over time:
Image

Orbital path of Earth over time:
Image

:idea: Maybe i should throw in a comet or another star.
simranjits
Posts: 83
Joined: Mon Jan 15, 2007 1:54 pm

Post by simranjits »

Why would u do a such a thing when there are so many free/commercial software that do the same? unless of course its some school project.
User avatar
mrngbss
Posts: 900
Joined: Wed Apr 12, 2006 8:27 am
Location: Bishan
Contact:

Post by mrngbss »

Writing a software is a very commendable feat. More for personal joy and fun. Just like making homemade telescopes. It's really great fun and learning too.
Wee Nghee the Pooh
simranjits
Posts: 83
Joined: Mon Jan 15, 2007 1:54 pm

Post by simranjits »

Yes i write software also , but i rarely reinvent the wheel unless neccessary , for example i use existing libraries .
ChaosKnight
Posts: 293
Joined: Sun Oct 05, 2003 6:54 pm

Post by ChaosKnight »

What happens if a Sun-mass star comes close to our Sun, passing slightly outside the orbit of Pluto?

Image

The orbits of all planets, especially the outer ones, get perturbed. The orbits of the inner planets become more eccentric.

Image

Because of increase in eccentricity, the energy Earth receives throughout the year becomes more extreme. Each cycle below represents a year, with W/m2 on the vertical axis.

Image
msuhaimi
Posts: 5
Joined: Wed Jan 31, 2007 12:22 am
Location: Bedok Reservoir
Contact:

Post by msuhaimi »

Hi ChaosKnight,

Thumbs up to ur wonderful SW. What prog. language do u use? ... very curious
User avatar
Airconvent
Super Moderator
Posts: 5803
Joined: Tue Sep 30, 2003 11:49 pm
Location: United Federation of the Planets

Post by Airconvent »

Interesting Project ChaosKnight.
Perhaps you can share your program with those who are interested? Also, you can make the post more meaningful by relating what got you started, how you created the programme, what info source you used, etc.
Cheers
The Boldly Go Where No Meade Has Gone Before
Captain, RSS Enterprise NCC1701R
United Federation of the Planets
ChaosKnight
Posts: 293
Joined: Sun Oct 05, 2003 6:54 pm

Post by ChaosKnight »

I did it in c++.

It is easy to write such a simulation. You require only 15minutes or so, but running the simulation can take as long as a few days, depending on the degree of accuracy you are after. This program is only 2d, but can easily be extended to 3d.

The main part is the equations, ie discretizing and computing the differential equations. Unfortunately as of now, the program is only first order accurate in space and time. It can be made second order with a little effort.

The input info is the starting positions of the planets, with their respective velocities. Because it isn't easy to get those data, the planets are simply strung out along the horizontal axis with their average velocities. Hence situations simulated are all hypothetical, with little quantitative value.
Post Reply