Skip to content

davidspiv/celestial_mechanics

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

89 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Celestial Mechanics Demo

Calculates state vectors of the solar system's planets at an arbitrary moment in time. Outputs both a 2D model of the system as a PNG and formatted distances in the console.

Get Started

Dependencies

  • Make
  • C++17 or higher

Build and Run

make && ./build/main

OR

make run

Implementation

The program uses two separate strategies to estimate planet vectors.

A.Using properties of a Keplerian Orbit:

  1. Normalize the Mean Anomaly to the specified date.
  2. Solve for the Eccentric Anomaly using Newton's Method.
  3. Convert the position along the orbital plane into heliocentric 3D Cartesian coordinates.

B. Using Newtonian physics and the N-body model:

  1. Obtain initial state vectors by following the same Keplerian orbit steps used for Terrestrial planets (excluding normalization to the target date).
  2. Calculate an acceleration vector for each planet by summing the gravitational effects from the Sun and other planets based on their masses and relative positions.
  3. Use the 4th-order Runge-Kutta method to numerically integrate the acceleration vectors twice — once for velocity and again for position — over the specified time step.
  4. Iterate over time steps, repeating steps 2–3 until the target time is reached.

Glossary

Astronomical units (AU) : the mean distance between the Earth and the Sun

Orbital Elements : a set of parameters designed to approximate the planet's orbit at a given epoch

J2000 Epoch : Jan 1, 2000 — the reference point for orbital elements used in this program

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 2

  •  
  •  

Languages