Skip to main content

create_system

create_system(G=gravitational_constant)

Create a new, empty orbital system.

This is the first step of every simulation. It returns a system with no bodies and a chosen gravitational constant. Add bodies to it with add_sun(), add_planet(), add_body() or add_body_keplerian(), then call simulate().

Parameters

Name Type Description Default
G float The gravitational constant in m^3 kg^-1 s^-2. The default is the measured value, orb.gravitational_constant (6.6743e-11). Set G=0 to turn gravity off, so that every body moves in a straight line at constant velocity. Other values let you work in different units or explore a universe with stronger or weaker gravity. gravitational_constant

Returns

Name Type Description
OrbitSystem An empty system, ready for bodies to be added.

See Also

Examples

import pyorbiter as orb

system = orb.create_system()
system
───────────────────────────────── orbit_system ─────────────────────────────────
G: 6.6743e-11 (standard)
Bodies: (none)

With gravity turned off, a body keeps its starting velocity.

import pyorbiter as orb

sim = (
    orb.create_system(G=0)
    .add_sun()
    .add_body("Probe", mass=1000, x=orb.distance_earth_sun, vy=orb.speed_earth)
    .simulate(time_step=orb.seconds_per_day, duration=10 * orb.seconds_per_day)
)
sim[sim["id"] == "Probe"].tail(3)
id mass x y z vx vy vz time
17 Probe 1000.0 1.496000e+11 2.058394e+10 0.0 0.0 29780.0 0.0 691200.0
19 Probe 1000.0 1.496000e+11 2.315693e+10 0.0 0.0 29780.0 0.0 777600.0
21 Probe 1000.0 1.496000e+11 2.572992e+10 0.0 0.0 29780.0 0.0 864000.0