Skip to contents

A convenience function that creates a complete solar system with the Sun and all eight planets (plus optionally the Moon and Pluto) using real orbital data. Bodies are placed using Keplerian orbital elements from the JPL DE440 ephemeris (J2000 epoch), giving realistic eccentricities, inclinations, and orbital orientations out of the box.

Usage

load_solar_system(moon = TRUE, pluto = TRUE)

Arguments

moon

Logical. If `TRUE` (the default), include the Moon in orbit around Earth.

pluto

Logical. If `TRUE` (the default), include Pluto.

Value

An `orbit_system` object containing the Sun and planets, ready for simulation.

Details

This is a quick way to get a physically accurate starting point without typing out a dozen [add_body()] calls. The returned system is a normal `orbit_system` that you can modify further — add bodies, change parameters, or pipe straight into [simulate_system()].

Examples

# \donttest{
# Simulate the full solar system for one year
solar <- load_solar_system() |>
  simulate_system(
    time_step = seconds_per_day,
    duration  = seconds_per_year
  )

plot_orbits(solar)
# Just the Sun and planets, no Moon or Pluto load_solar_system(moon = FALSE, pluto = FALSE) #> $bodies #> # A tibble: 9 × 8 #> id mass x y z vx vy vz #> <chr> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> #> 1 Sun 1.99e30 0 0 0 0 0 0 #> 2 Mercury 3.30e23 1.01e10 4.48e10 2.73e 9 -57287. 12561. 6280. #> 3 Venus 4.87e24 -7.11e10 8.04e10 5.20e 9 -26354. -23404. 1200. #> 4 Earth 5.97e24 -3.30e10 1.43e11 0 -29520. -6788. 0 #> 5 Mars 6.42e23 1.89e11 -8.37e10 -6.40e 9 10750. 24226. 243. #> 6 Jupiter 1.90e27 7.17e11 1.83e11 -1.68e10 -3394. 13287. 21.0 #> 7 Saturn 5.68e26 -7.38e10 1.35e12 -2.07e10 -10158. -549. 414. #> 8 Uranus 8.68e25 -2.71e12 4.18e11 3.65e10 -1087. -7035. -11.6 #> 9 Neptune 1.02e26 3.15e12 3.14e12 -1.37e11 -3880. 3893. 9.45 #> #> $forces #> $forces$gravity #> $forces$gravity$type #> [1] "n_body_gravity" #> #> $forces$gravity$G #> [1] 6.6743e-11 #> #> #> #> $time #> [1] 0 #> #> attr(,"class") #> [1] "orbit_system" # }