Periodic Orbits Example

This example demonstrates how to compute periodic orbits in the Circular Restricted Three-Body Problem (CR3BP).

Computing periodic orbits in the CR3BP
 1"""Example script: generation of several families of periodic orbits (Vertical,
 2Halo, planar Lyapunov) around an Earth-Moon libration point.
 3
 4Run with
 5    python examples/periodic_orbits.py
 6"""
 7
 8import os
 9import sys
10
11sys.path.append(os.path.join(os.path.dirname(__file__), "..", "src"))
12
13from hiten.system import (HaloOrbit, LyapunovOrbit, System,
14                          VerticalOrbit)
15from hiten.utils.log_config import logger
16
17
18def main() -> None:
19    # Build system & centre manifold
20    system = System.from_bodies("earth", "moon")
21    l_point = system.get_libration_point(1)
22    cm = l_point.get_center_manifold(degree=6)
23    cm.compute()
24
25    ic_seed = cm.to_synodic([0.0, 0.0], 0.6, "q3") # Good initial guess from CM
26    logger.info("Initial conditions (CM to physical coordinates): %s", ic_seed)
27
28    # Specifications for each family we wish to generate
29    orbit_specs = [
30        {
31            "cls": VerticalOrbit,
32            "name": "Vertical",
33            "kwargs": {"initial_state": ic_seed},
34        },
35        {
36            "cls": HaloOrbit,
37            "name": "Halo",
38            "kwargs": {"amplitude_z": 0.2, "zenith": "southern"},
39        },
40        {
41            "cls": LyapunovOrbit,
42            "name": "Planar Lyapunov",
43            "kwargs": {"amplitude_x": 0.1},
44        },
45    ]
46
47    for spec in orbit_specs:
48
49        orbit = l_point.create_orbit(spec["cls"], **spec["kwargs"])
50
51        orbit.correct()
52        print(f"Corrected state: {orbit.initial_state} | Period: {orbit.period}")
53        orbit.propagate(steps=1000)
54        orbit.plot("rotating")
55
56if __name__ == "__main__":
57    main()