Heteroclinic Connection Example
This example demonstrates how to compute heteroclinic connections between periodic orbits in the Circular Restricted Three-Body Problem (CR3BP).
Computing heteroclinic connections in the CR3BP
1"""Example script: Detecting heteroclinic connections between two manifolds.
2
3This example demonstrates how to use the ConnectionPipeline class with the to find impulsive transfers between
4manifolds in the CR3BP.
5
6Run with
7 python examples/heteroclinic_connection.py
8"""
9
10import os
11import sys
12
13sys.path.append(os.path.join(os.path.dirname(__file__), "..", "src"))
14
15from hiten.algorithms.connections import ConnectionPipeline
16from hiten.algorithms.connections.config import _ConnectionConfig
17from hiten.algorithms.poincare import SynodicMapConfig
18from hiten.system import System
19
20
21def main() -> None:
22 system = System.from_bodies("earth", "moon")
23 mu = system.mu
24
25 l1 = system.get_libration_point(1)
26 l2 = system.get_libration_point(2)
27
28 halo_l1 = l1.create_orbit('halo', amplitude_z=0.5, zenith='southern')
29 halo_l1.correct()
30 halo_l1.propagate()
31
32 halo_l2 = l2.create_orbit('halo', amplitude_z=0.3663368, zenith='northern')
33 halo_l2.correct()
34 halo_l2.propagate()
35
36 manifold_l1 = halo_l1.manifold(stable=True, direction='positive')
37 manifold_l1.compute(integration_fraction=0.9, step=0.005)
38
39 manifold_l2 = halo_l2.manifold(stable=False, direction='negative')
40 manifold_l2.compute(integration_fraction=1.0, step=0.005)
41
42 section_cfg = SynodicMapConfig(
43 section_axis="x",
44 section_offset=1 - mu,
45 plane_coords=("y", "z"),
46 interp_kind="cubic",
47 segment_refine=30,
48 tol_on_surface=1e-9,
49 dedup_time_tol=1e-9,
50 dedup_point_tol=1e-9,
51 max_hits_per_traj=None,
52 n_workers=None,
53 )
54
55 # Create unified configuration with all parameters in one object
56 config = _ConnectionConfig(
57 section=section_cfg, # Synodic section configuration
58 direction=-1, # Crossing direction (None = both directions)
59 delta_v_tol=1, # Maximum Delta-V tolerance
60 ballistic_tol=1e-8, # Threshold for ballistic classification
61 eps2d=1e-3, # 2D pairing radius
62 )
63
64 # Create connection using the factory method with unified config
65 conn = ConnectionPipeline.with_default_engine(config=config)
66
67 result = conn.solve(manifold_l1, manifold_l2)
68
69 print(result)
70
71 conn.plot(dark_mode=True)
72
73 conn.plot_connection(dark_mode=True)
74
75
76if __name__ == "__main__":
77 main()