apps121025_test_liouville.app01_setup
ΒΆ
A simple setup.
Set a massive star in the center. Set a particle (reference) at the arbitrary position. Set a particle velocity (reference) at
To eliminate the problem into 2D x 2D for the first step, the particle position is on x-axis and the velocity has only vx, vy components.
''' A simple setup.
Set a massive star in the center.
Set a particle (reference) at the arbitrary position.
Set a particle velocity (reference) at
To eliminate the problem into 2D x 2D for the first step,
the particle position is on x-axis and the velocity
has only vx, vy components.
'''
import numpy as np
import matplotlib.pyplot as plt
import irfpy.util.keplernumeric as kepler
def main():
### Set the mass (center). Assume Jupiter (roughly).
ms = 2e27 # kg
### Set the particle position. Assume Io position.
pos = np.array([4.5e8, 0, 0]) # m
### Set the particle velocity. Assume 10 km/s at 60 deg inward from x.
vel = np.array([-10e3 * 0.5, 10e3 * np.sqrt(3./4), 0])
### Instance the kepler class
kep = kepler.Kepler2RungeKutta(ms, 1., pos, vel)
### Trace the particle along the time.
tlist = np.arange(0, 3e4, 60)
print(len(tlist))
posvel = kep.get_posvel(tlist)
plt.figure()
plt.subplot(211)
plt.plot(posvel[:, 0], posvel[:, 1])
plt.subplot(212)
plt.plot(posvel[:, 3], posvel[:, 4])
plt.gca().set_aspect('equal')
plt.savefig('app01_setup.png')
if __name__ == "__main__":
main()