Invariant Tori Example

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

Computing invariant tori in the CR3BP
 1"""Example script: computing the invariant torus for the Earth-Moon halo orbit.
 2
 3Run with
 4    python examples/invariant_tori.py
 5"""
 6
 7import os
 8import sys
 9
10sys.path.append(os.path.join(os.path.dirname(__file__), "..", "src"))
11
12from hiten import System
13from hiten import InvariantTori
14
15
16def main() -> None:
17    system = System.from_bodies("earth", "moon")
18    l_point = system.get_libration_point(1)
19
20    orbit = l_point.create_orbit('halo', amplitude_z=0.3, zenith='southern')
21    correction_opts = orbit.correction_options.merge(
22        base=orbit.correction_options.base.merge(
23            convergence=orbit.correction_options.base.convergence.merge(max_attempts=25)
24        )
25    )
26    orbit.correct(options=correction_opts)
27    orbit.propagate(steps=1000)
28
29    torus = InvariantTori(orbit)
30    torus.compute(epsilon=1e-2, n_theta1=512, n_theta2=512)
31    torus.plot()
32
33if __name__ == "__main__":
34    main()