2025-05-31 14:56:00 -04:00

31 lines
760 B
Python

from orbiter.orbits.body import Body
from orbiter.orbits.simulator import Simulator
from orbiter.units import *
from pathlib import Path
#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 = 1e-10
n_steps = time_to_run/STEP_SIZE
s = Simulator([earth,person], STEP_SIZE, 1, Path("hello_world"))
print(n_steps)
s.run(int(time_to_run/STEP_SIZE))
print(real_vel(person.V))