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

  • Thread starter vb7prog
  • Start date
  • Tags
    Orbit
In summary, the conversation discusses the building of a physics simulator to test object trajectories and the challenges faced in creating accurate formulas. The use of the universal gravitational constant, the radius of the Earth, and the differential equation for calculating acceleration due to gravity are mentioned. Suggestions for solving the differential equation and improving the accuracy of the simulation are also given.
  • #1
vb7prog
2
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-resistence 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 accleration 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
  • #2
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.
 
  • #3
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
 
  • #4
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.
 
  • #5
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}
\mathbf r(t+\Delta t) &= \mathbf r(t) + \Delta t \,\mathbf v (t) \\
\mathbf v(t+\Delta t) &= \mathbf v(t) + \Delta t \,\mathbf a (t)
\end{aligned}
[/tex]

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

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

How do you send an object into orbit?

To send an object into orbit, you need to launch it with enough speed and force to counteract the Earth's gravitational pull. This can be achieved through the use of rockets or other propulsion systems. Once the object is in space, it must also maintain a certain speed and trajectory to stay in orbit.

What factors affect the orbit of an object?

The orbit of an object is affected by several factors, including the mass and velocity of the object, the gravitational pull of the planet or body it is orbiting, and any external forces acting on it (such as atmospheric drag or the gravitational pull of other objects).

How high do you need to go to reach orbit?

To achieve orbit around the Earth, an object needs to reach an altitude of at least 100 kilometers (62 miles). This is known as the Kármán line, and it marks the boundary between Earth's atmosphere and outer space.

Can any object be sent into orbit?

Technically, any object can be sent into orbit as long as it has enough speed and force to overcome the Earth's gravitational pull. However, practical limitations such as cost and technology may make it difficult or impossible to send certain objects into orbit.

How do objects stay in orbit?

Once an object is in orbit, it stays there because of the balance between its forward motion and the downward pull of gravity. This is known as centripetal force. As long as these forces remain balanced, the object will continue to orbit the planet or body it is orbiting.

Similar threads

Replies
58
Views
3K
Replies
7
Views
1K
Replies
2
Views
2K
Replies
11
Views
965
Replies
9
Views
2K
Back
Top