View source: R/continue_simulation.R
| system_from_simulation | R Documentation |
Takes the state of every body at one time step of a simulation and returns a new 'orbit_system' with those positions and velocities as its initial conditions. This is the bridge from a finished run back to a system you can modify (add a body, remove one, change a velocity) and simulate again.
system_from_simulation(sim_data, time = NULL, G = NULL)
sim_data |
A tibble output from [simulate_system()]. |
time |
The simulation time (in seconds) of the snapshot to use. Defaults to the last time step. Snaps to the closest available time. |
G |
The gravitational constant for the new system. Defaults to the value recorded by [simulate_system()] in the '"G"' attribute of 'sim_data', or to [gravitational_constant] if that is absent. |
An ‘orbit_system' whose bodies have the snapshot’s positions and velocities.
sim <- create_system() |>
add_sun() |>
add_planet("Earth", parent = "Sun") |>
simulate_system(time_step = seconds_per_day, duration = seconds_per_day * 100)
# Where everything was on day 100, as a system ready to simulate again
later <- system_from_simulation(sim)
later
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.