Astro simulation program problem - program bugs?

AI Thread Summary
The discussion revolves around a simulation project aimed at modeling the interaction of orbital objects, where users input parameters like mass and velocity. The developers are facing significant issues with the accuracy of their calculations, particularly with the Earth-Sun simulation, which shows the Earth veering off its orbit. They believe the formulas used are correct but suspect the problem lies in the principles applied in their calculations. A key point of confusion is whether to sum all forces before calculating acceleration or to average speed, which has led to further complications. Assistance is sought from the community, and they are open to sharing their C++ source code for troubleshooting.
concious
Messages
3
Reaction score
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
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?
 
What difference does that make if we sum the forces or the delta_speed? :?
 
I thought you were saying you averaging them
 
Yes, that was a mistake, there should be accel * time / 2... Though it doesn't help :/.
 
Last edited:
This thread is dedicated to the beauty and awesomeness of our Universe. If you feel like it, please share video clips and photos (or nice animations) of space and objects in space in this thread. Your posts, clips and photos may by all means include scientific information; that does not make it less beautiful to me (n.b. the posts must of course comply with the PF guidelines, i.e. regarding science, only mainstream science is allowed, fringe/pseudoscience is not allowed). n.b. I start this...
Today at about 4:30 am I saw the conjunction of Venus and Jupiter, where they were about the width of the full moon, or one half degree apart. Did anyone else see it? Edit: The moon is 2,200 miles in diameter and at a distance of 240,000 miles. Thereby it subtends an angle in radians of 2,200/240,000=.01 (approximately). With pi radians being 180 degrees, one radian is 57.3 degrees, so that .01 radians is about .50 degrees (angle subtended by the moon). (.57 to be more exact, but with...
Back
Top