- #1
darkdave
- 24
- 0
I am building a spacecraft simulator in a realistic planetary environment. At the moment it uses very simple Newtonian equations of motion. Each object has displacement, velocity and acceleration vectors. Each time the computer does a loop: 0.1 seconds pass and in each loop each object (planet, spacecraft , moon etc) moves along it's displacement vector (in 3D space) by exactly 0.1 seconds. The velocity vector adds the acceleration vector to it self multiplied by the time 0.1 seconds. The acceleration vector is then adjusted for all objects according to the new Center of Gravity of the entire simulation.
The problem with this is that its not too accurate especially when you accelerate time in which case 0.1 seconds per time loop can be as large as 1 hour! Then errors will show up because the center of gravity changes every hour in a dynamic system and therefore the acceleration vector for each object should also change during that 1 hour time frame. The redisplacement of objects will also be in a straight line and they should be in a curve!
I played with Newton's Gm1m2/rsquared force equation and extracted the acceleration equation Gm2/rsquared equation for m1's acceleration toward m2 assuming m2 is a larger body like Earth. Now I did some calculus and integrated that equation to find a way to extract the change in velocity (average acceleration) by substituting different values of "r" (distance between m1 and m2). In this case I can have an equation that tells me the change in velocity in a straight line between the rocket and Earth if the rocket was falling to the Earth vertically. This is a start but not useful enough for a dynamic simulator where the rocket might have a path beyond just falling straight down. Also this equation gives the change in velocity per unit distance and I need it per unit time. It also does not give me the gradual change in the acceleration vector in a dynamic situation such as a spacecraft flying pass a planet at high speed in which case it will be attracted toward the planet's center that will constantly change relative position to it.
Is there a formula I can use in my computer simulator to calculate position, velocities and acceleration of N body problem with the passage of accelerated time without losing accuracy of the simulation? Or do I just have to run many 0.1 second loops more quickly in order to accelerate time or predict the future paths of all objects?
The problem is that each of my computer loops displaces the objects linearly by assuming the accleration vector does not change in strength nor direction during that straight line transition. A more realistic loop should displace the object via a curve that anticipates the change in acceleration's magntitude and direction pull on the object during the transition from time zero to time 0.1s.
However the simulation is reasonably accurate as long as each iteration is about 0.1 seconds, meaning that many many inferior discrete linear predictions over a short time simulates curve paths over many seconds. But that still leaves me with the problem of predicting future paths or time acceleration in my simulation.
The problem with this is that its not too accurate especially when you accelerate time in which case 0.1 seconds per time loop can be as large as 1 hour! Then errors will show up because the center of gravity changes every hour in a dynamic system and therefore the acceleration vector for each object should also change during that 1 hour time frame. The redisplacement of objects will also be in a straight line and they should be in a curve!
I played with Newton's Gm1m2/rsquared force equation and extracted the acceleration equation Gm2/rsquared equation for m1's acceleration toward m2 assuming m2 is a larger body like Earth. Now I did some calculus and integrated that equation to find a way to extract the change in velocity (average acceleration) by substituting different values of "r" (distance between m1 and m2). In this case I can have an equation that tells me the change in velocity in a straight line between the rocket and Earth if the rocket was falling to the Earth vertically. This is a start but not useful enough for a dynamic simulator where the rocket might have a path beyond just falling straight down. Also this equation gives the change in velocity per unit distance and I need it per unit time. It also does not give me the gradual change in the acceleration vector in a dynamic situation such as a spacecraft flying pass a planet at high speed in which case it will be attracted toward the planet's center that will constantly change relative position to it.
Is there a formula I can use in my computer simulator to calculate position, velocities and acceleration of N body problem with the passage of accelerated time without losing accuracy of the simulation? Or do I just have to run many 0.1 second loops more quickly in order to accelerate time or predict the future paths of all objects?
The problem is that each of my computer loops displaces the objects linearly by assuming the accleration vector does not change in strength nor direction during that straight line transition. A more realistic loop should displace the object via a curve that anticipates the change in acceleration's magntitude and direction pull on the object during the transition from time zero to time 0.1s.
However the simulation is reasonably accurate as long as each iteration is about 0.1 seconds, meaning that many many inferior discrete linear predictions over a short time simulates curve paths over many seconds. But that still leaves me with the problem of predicting future paths or time acceleration in my simulation.
Last edited: