A shortcut for add_body("Sun", mass=orb.mass_sun). The body is named "Sun" and by default sits at rest at the origin, which is the usual starting point for a planetary system. Change mass to model a different star. Also available as orb.add_sun(system, ...).
Parameters
Name
Type
Description
Default
mass
float
Mass in kilograms. The default is the mass of the Sun, orb.mass_sun (1.989e30 kg).
mass_sun
x
float
Initial position along the x axis, in meters. Default 0.
0
y
float
Initial position along the y axis, in meters. Default 0.
0
z
float
Initial position along the z axis, in meters. Default 0.
0
vx
float
Initial velocity along the x axis, in meters per second. Default 0.
0
vy
float
Initial velocity along the y axis, in meters per second. Default 0.
0
vz
float
Initial velocity along the z axis, in meters per second. Default 0.
0
Returns
Name
Type
Description
OrbitSystem
A new system with a body named "Sun" added. The original system is not modified.
Raises
Name
Type
Description
ValueError
If the system already has a body named "Sun", if mass is not a single number, or if mass is negative.
import pyorbiter as orbsystem = orb.create_system().add_sun().add_planet("Earth", parent="Sun")system
───────────────────────────────── orbit_system ─────────────────────────────────
G: 6.6743e-11 (standard)
Bodies: 2
id mass x y z vx vy vz
Sun 1.989000e+30 0.000000e+00 0.000000e+00 0.0 0.000000 0.000000 0.0
Earth 5.972000e+24 -3.296559e+10 1.433603e+11 0.0 -29520.187051 -6788.143346 0.0
A star with half the mass of the Sun.
import pyorbiter as orbsystem = orb.create_system().add_sun(mass=0.5* orb.mass_sun)system
───────────────────────────────── orbit_system ─────────────────────────────────
G: 6.6743e-11 (standard)
Bodies: 1
id mass x y z vx vy vz
Sun 9.945000e+29 0.0 0.0 0.0 0.0 0.0 0.0