2025-05-31 17:38:26 -04:00

33 lines
795 B
Python

from orbiter.orbits.body import Body
from orbiter.orbits.simulator import Simulator
from orbiter.units import *
from pathlib import Path
from decimal import Decimal, getcontext
getcontext().prec = 100
#set up the earth
earth = Body(
Position([0,0,0]),
Velocity([0,0,0]),
Mass(norm_mass(EARTH_MASS)),
"Earth"
)
#Lets try a body just outside earth accelerating in. Should be 9.8m/s2
person = Body(
Position([norm_pos(EARTH_RADIUS+100_000),0,0]), #10_000m in the sky, airliner height!
Velocity([0,0,0]), #start from standstill
Mass(norm_mass(80)), #avg person
"Person"
)
time_to_run = norm_time(5)
STEP_SIZE = Decimal(1e-10)
n_steps = time_to_run/STEP_SIZE
s = Simulator([earth,person], STEP_SIZE, 1, Path("hello_world"))
s.run(10)
print(real_vel(person.V))