I'm trying to simulate moon orbit around earth, my moon is broken.

Click For Summary
The discussion focuses on simulating the moon's orbit around the Earth using a 2D model in Excel, with the goal of eventually simulating a spacecraft's Hohmann transfer. The user has set up initial conditions, including the moon's position and velocity, but is encountering issues with the simulation's accuracy, particularly regarding the moon's movement along the Y-axis. Key problems identified include the need for proper application of the time step in calculations and potential issues with the angle calculations due to the use of degrees instead of radians. Suggestions from other users include simplifying the angle calculations using the atan2 function and ensuring that gravitational acceleration is correctly applied. Overall, the user seeks guidance on correcting their approach to achieve a more accurate simulation.
  • #31
BvU said:
Enjoyed playing with this, even though I just noticed I was a little too late !:frown:

Ah well, no worries! Thanks anyway :D

I toyed around with my moon and set the initial position and speed to the moon's perigee and max velocity: http://nssdc.gsfc.nasa.gov/planetary/factsheet/moonfact.html

Ran it like that and I got a very neat eclipse orbit with it's apogee nearly exactly at where our moon's actual apogee is.

Now to start coding my moon ship so I can get a Hohmann transfer underway!


adjacent said:
Is excel this powerful? I though it's something accountants use for their work. -_-

It's got a whole programming language under the hood that can be utilized. Of course, it's not the best qua performance to run an astrophysics simulation, but Excel's all we have at school, and it works perfectly fine!
 
Physics news on Phys.org
  • #32
BvU said:
You want to update the vx and vy using the * timestep too !

He did, read the code again.
 
  • #33
Borek said:
He did, read the code again.
You're right. I had moved the *timestep down to the vx, vy expression to keep dimension of a in lline with naming and also to get the right values for ax, ay, am in the table. In fact, now I start wondering if the expression for px, py improves if 0.5 * timestep is used instead of *timestep...
 
  • #34
adjacent said:
Is excel this powerful? I though it's something accountants use for their work. -_-
Excel on its own is already extremely powerful. With VBA as programming language with quite some object orientation is powerful squared.

Biggest drawback is that in practice it is the epitome of unstructured programming, so re-use and knowledge transfer are disaster areas.

Having said that, there's an awful lot of science and technology it can be (and is) used for.
 

Similar threads

  • · Replies 11 ·
Replies
11
Views
1K
Replies
1
Views
991
  • · Replies 2 ·
Replies
2
Views
2K
  • · Replies 38 ·
2
Replies
38
Views
4K
  • · Replies 7 ·
Replies
7
Views
3K
Replies
3
Views
1K
Replies
5
Views
5K
  • · Replies 6 ·
Replies
6
Views
2K
  • · Replies 5 ·
Replies
5
Views
8K
  • · Replies 1 ·
Replies
1
Views
1K