What is the best way to simulate an object in orbit?

  • Context: Undergrad 
  • Thread starter Thread starter vb7prog
  • Start date Start date
  • Tags Tags
    Orbit
Click For Summary

Discussion Overview

The discussion revolves around simulating an object in orbit, focusing on the equations of motion and gravitational forces involved in such simulations. Participants explore the challenges of accurately modeling the physics of orbital mechanics, particularly in the absence of air resistance and the effects of varying gravitational acceleration at different altitudes.

Discussion Character

  • Exploratory
  • Technical explanation
  • Debate/contested
  • Mathematical reasoning

Main Points Raised

  • One participant describes their current simulation setup, noting that objects either escape Earth's gravity or fall back, leading them to suspect issues with their formulas.
  • Another participant points out that the acceleration due to gravity is not constant and suggests using the formula F_g = G M m / r^2, emphasizing the need to consider varying distances from the Earth's center.
  • A participant mentions integrating time into a loop for their simulation and expresses confusion about the necessity of differential equations, asserting that their calculations seem to be straightforward algebra.
  • Another reply clarifies that the height equation used is valid only for constant acceleration and suggests that the participant is indeed solving a differential equation related to gravitational forces.
  • One participant critiques the use of the gravitational force equation, noting that it is not correctly expressed and highlights the importance of understanding units and the nature of forces in physics.
  • Another participant introduces the Euler method for solving differential equations, explaining its simplicity and potential inaccuracies, and suggests exploring more advanced methods like Runge-Kutta for better results.

Areas of Agreement / Disagreement

Participants express differing views on the necessity and application of differential equations in the simulation. While some emphasize the importance of accounting for varying gravitational forces and the need for a more complex model, others maintain that their approach is sufficient for their current understanding. No consensus is reached regarding the best method for simulating orbital mechanics.

Contextual Notes

Limitations include the assumption of constant acceleration in certain equations, the dependence on initial conditions, and the complexity introduced by three-dimensional motion and external forces. The discussion highlights the need for careful consideration of these factors in simulations.

vb7prog
Messages
2
Reaction score
0
Hi, I'm trying to build a physics simulator right now its just doing launching an object a a certain velocity and angle and see when it lands or if it escapes Earth's gravity. It appears like the simulator is working but then to test it I tried getting an object to orbit and it can't so it leads me to think my formulas are messed up. objects either fly away or never escape...

first I am ignoring air-resistance right now, but i am taking into account the change in gravity as you get higher up:

A = 398658366000000.0;
B = 6367443;

calcGravity = A / ((B + height of object)^2)

^^ I feel good about this one, B is the radius of the Earth averaged between the equator and the poles, A is the universal gravity constant times the mass of earth, with calcGravity being equal to the acceleration due to gravity (9.8 m/s^2 near the surface of the earth)

height = ( upwards velocity * time in seconds) - (1/2 of calcGravity) * (time^2)

basically height = v*t - 0.5*a*(t^2)

is there something wrong with these equations or do they not apply at extreme altitudes, I'm not that great at physics so maybe I am missing something, i do have a feeling that it has to do with the fact that the vertical velocity is constant and somehow needs to be curtailed at some point, but at what point or how is beyond me...
 
Physics news on Phys.org
You should note that the acceleration due to gravity is not constant. The formula would be
[tex]F_g = \frac{G M m}{r^2}[/tex]
where G is the universal gravitational constant, M is the mass of the earth, m is the mass of the object you're launching and r is the distance from the center of the earth to the object.
For distances r which are close to the radius of the earth, this formula reduces to the familiar [itex]F = m g[/itex], where g \approx 9.81 takes into account the G M factor. But if the distance varies considerably, you might have to take this effect into account (and would get a differential equation for r, which you would have to solve).

Note that you have a quadratic equation for the height, which will always have two zeroes (t = 0 and some t = T). So no matter how large you make the initial velocity, the object will always come back down.
 
this is a programming hobby of mine and the time is integrated into a loop and before i do the main calculation the new acceleration of gravity is computed

Im using the equation Fg = GM/R^2, I am adding the current height of the object to the radius in the calculations, I'm not sure where a differential equation would come in as it seems to me straight algebra, I am only missing one value Fg.

as for the quadratic since the acceleration due to gravity is always getting smaller I don't see how the height will be falling. it may be true but if you saw the numbers Earth's gravitation is headed for zero and it looks like the object is not coming back

lim g->0 100t - 1/2gt^2
 
It appears that you are computing the solution of the differential equation:
y'' = -k/(r+y)^2 where k = G*M_1*M_2, but something like height = v*t - 0.5*a*(t^2) doesn't belong in there because it's only valid for constant acceleration.
A simple program to solve the differential equation (in 1 dimension)
y = 0 //initial height (m)
v = 5000 // initial speed (m/s)
dt = 0.01 //time step (s)
k = G * M_1 * M_2
r = 6367443 // radius of earth
t = 0
repeat:
t = t + dt
g = - k/(r+y)^2
v = v + g * dt
y = y + v * dt
until some suitable end condition

this is known as the Euler method for solving differential equation, and is simple but
rather inaccurate and it will need a very small timestep. The error is caused because of the assumption that g and v will be constant during the time interval from t to t+dt. Search around for runge-kutta method.
 
vb7prog said:
Im using the equation Fg = GM/R^2, I am adding the current height of the object to the radius in the calculations, I'm not sure where a differential equation would come in as it seems to me straight algebra, I am only missing one value Fg.
What you have written, Fg=GM/R^2 is not "straight algebra". It is not even correct. GM/R^2 has units of acceleration, not force. The gravitational force has magnitude GMm/R^2. Dividing by the mass of the object yields GM/R^2. Yes, so I'm being picky, but getting units incorrect is one of the most common mistakes students make when solving physics problems.

So why is this not straight algebra? Acceleration is the second derivative of distance, and the distance is changing with time. This seemingly simple is in fact a second order differential equation. In fact, it's worse than that. Force is a vector, not a scalar. What you have is actually a three-dimensional differential equation. You can simplify it to two (or one) dimensions only if gravity, external forces such as rocket thrust, and the initial velocity are coplanar (colinear). Since the rocket takes off from the surface of the rotating Earth, the initial velocity is not colinear with the gravitational force. In other words, the problem is two-dimensional at a minimum.

If you want something even close to realism, you should use a vector form such as

[tex]\mathbf a = \frac {\mathbf F_{\text{ext}}}{m} - \frac {GM_{\oplus}}{||\mathbf r||^3}\mathbf r[/tex]

So how to integrate this? You need some model of the external force, [itex]\mathbf F_{\text{ext}}}[/itex] as expressed in some inertial frame. You can start with a rocket thrusting straight up, but keep in mind that real rockets don't do that. They turn as the ascend so that the thrust is horizontal by the time they reach orbital altitude.

A simple way to integrate the state (position and velocity) is via Euler's method:

[tex] \begin{aligned}<br /> \mathbf r(t+\Delta t) &= \mathbf r(t) + \Delta t \,\mathbf v (t) \\<br /> \mathbf v(t+\Delta t) &= \mathbf v(t) + \Delta t \,\mathbf a (t)<br /> \end{aligned}[/tex]

Beware, Euler integration is very inaccurate. Nonetheless, understanding how Euler integration works is an essential step to understanding more advanced methods.
 

Similar threads

  • · Replies 58 ·
2
Replies
58
Views
4K
  • · Replies 7 ·
Replies
7
Views
3K
  • · Replies 9 ·
Replies
9
Views
2K
  • · Replies 4 ·
Replies
4
Views
2K
  • · Replies 10 ·
Replies
10
Views
2K
  • · Replies 7 ·
Replies
7
Views
2K
  • · Replies 11 ·
Replies
11
Views
2K
  • · Replies 8 ·
Replies
8
Views
2K
  • · Replies 2 ·
Replies
2
Views
1K
  • · Replies 2 ·
Replies
2
Views
1K