Astro simulation program problem - program bugs?

In summary, the conversation discusses a project involving simulation of orbital objects interaction. The simulation is based on timesteps and uses formulas to calculate the distance between objects, gravitational force, and speed. However, there is a problem with the calculations that is causing the Earth to go out of orbit. The speakers are seeking help and are willing to share their sources with anyone interested.
  • #1
concious
3
0
Hello all,

for the past few weeks my friend and me have been working on a project involving simulation of orbital objects interaction. For example, one could see how everything looks if he/she entered all the details about the objects (that is: mass, position and velocity vector). The simulation is based on timesteps, that is, the system calculates new positions of objects after a timestep (default is one day). One can see how everything looks by "timestepping".

The problem is, the calculations are bogus!
Moreover, the formulas used MUST be right and this puts us into confusion:
the problem lies not in the program but in the principle used.

We pick each two objects, calculate the distance between them, the gravitational force between the objects, the average of speed gained ant the latter is added to objects' speed (obj.speed.x += accel.x * time_step / 2). After all that we move all the objects (like obj.place.x += obj.speed.x * time_step).
Everything is calculated in the SI.

We tested the system with the Earth and the Sun and it results in Earth going out of the orbit! So something's certainly wrong...

We would appreciate any help. If there is any interest, we can send you the sources (C++, GPL license) which compile great on Win32 and Linux (OpenGL is used for displaying 3D graphics).

Thanks in advance.
 
Last edited:
Astronomy news on Phys.org
  • #2
aren't you supposed to sum all the forces and then divide by object mass and multiply that by delta_t and add that to speed?
 
  • #3
What difference does that make if we sum the forces or the delta_speed? :?
 
  • #4
I thought you were saying you averaging them
 
  • #5
Yes, that was a mistake, there should be accel * time / 2... Though it doesn't help :/.
 
Last edited:

1. What is an astro simulation program and what is its purpose?

An astro simulation program is a computer software used to simulate and model astronomical phenomena, such as the motion of planets and stars. Its purpose is to aid in understanding and predicting the behavior of astronomical objects and systems.

2. What are program bugs and why do they occur in astro simulation programs?

Program bugs are errors or flaws in a computer program that cause it to produce incorrect or unexpected results. They occur in astro simulation programs due to mistakes in the coding or programming, incorrect assumptions or calculations, or limitations in the simulation model.

3. How do program bugs affect the accuracy of astro simulation programs?

Program bugs can significantly affect the accuracy of astro simulation programs by producing incorrect or unrealistic results. This can lead to inaccurate predictions and hinder the understanding of astronomical phenomena.

4. How do scientists identify and fix program bugs in astro simulation programs?

Scientists use various methods to identify and fix program bugs in astro simulation programs. This includes debugging tools, code reviews, and testing the program with different scenarios. Once a bug is identified, it can be fixed by correcting the code or making necessary adjustments to the simulation model.

5. How can we prevent program bugs in astro simulation programs?

To prevent program bugs in astro simulation programs, it is important to have a thorough understanding of the simulation model and to test the program extensively before using it for scientific research. Regular maintenance and updates to the program can also help prevent bugs from occurring. Additionally, following good coding practices and using reliable programming languages can reduce the chances of program bugs.

Similar threads

  • Classical Physics
Replies
2
Views
1K
  • Astronomy and Astrophysics
Replies
7
Views
4K
  • Classical Physics
Replies
15
Views
2K
  • Astronomy and Astrophysics
Replies
1
Views
3K
  • Astronomy and Astrophysics
Replies
6
Views
2K
Replies
2
Views
1K
Replies
2
Views
10K
Replies
16
Views
3K
  • Programming and Computer Science
Replies
2
Views
2K
  • Calculus and Beyond Homework Help
Replies
10
Views
6K
Back
Top