11classdef CR3BPProblem < otp .Problem
2- % The circular restricted three body problem
2+ % The circular restricted three body problem, following the formulation
3+ % presented in :cite:p:`Spr21`.
4+ %
5+ % The system represents the evolution of an object of negligent mass
6+ % near two large-mass objects that orbit each other a constant distance
7+ % apart. The ratio of the mass of the first object to the sum of the
8+ % total mass of the system is represented by the non-dimensional
9+ % constant $\mu$. The reference frame of the system is fixed to the
10+ % rotationg frame of the two objects, meaning that the objects have
11+ % fixed constant postions of $(\mu,0,0)^T$ for the first object, and
12+ % $(1 - \mu,0,0)^T$ for the second object. The evolution of the third
13+ % object of negligent mass is given by the following second-order
14+ % non-dimensionalized differential equation:
15+ %
16+ % $$
17+ % x'' &= σ(y - x),\\
18+ % y'' &= ρx - y - xz,\\
19+ % z'' &= xy - βz,\\
20+ % U &= \frac{1}{2} (x^2 + y^2) + \frac{1 - \mu}{d} + \frac{mu}{r},\\
21+ % d &= \sqrt{(x + \mu)^2 + y^2 + z^2},\\
22+ % r &= \sqrt{(x - 1 + \mu)^2 + y^2 + z^2},
23+ % $$
24+ %
25+ % where the system is converted to a differential equation in six
26+ % variables in the standard fashion. The distances $d$ and $r$ can
27+ % cause numerical instability as they approach zero, thus a softening
28+ % factor of $s^2$ is typically added under both of the square-roots.
29+ %
30+ % The system of equations is energy-preserving, meaning that the Jacobi
31+ % constant of the system,
32+ %
33+ % $$
34+ % J = 2U - x'^2 - y'^2 - z'^2,
35+ % $$
36+ %
37+ % is preserved throughout the evolution of the equations, though this
38+ % is typically not true numerically.
339 %
440 % Notes
541 % -----
1450 % Example
1551 % -------
1652 % >>> problem = otp.cr3bp.presets.NRHO;
17- % >>> sol = model.solve('AbsTol', 1e-14, 'RelTol', 100*eps );
53+ % >>> sol = model.solve();
1854 % >>> problem.plotPhaseSpace(sol);
1955 %
2056 % See Also
3773 obj@otp.Problem(' Circular Restricted 3 Body Problem' , 6 , timeSpan , y0 , parameters );
3874 end
3975 end
76+
77+ properties (SetAccess = private )
78+ JacobiConstant
79+ end
4080
4181 methods (Access = protected )
4282 function onSettingsChanged(obj )
4383 mu = obj .Parameters .Mu ;
4484 soft = obj .Parameters .SoftFactor ;
85+
86+ obj.JacobiConstant = @(y ) otp .cr3bp .jacobiconstant(y , mu , soft );
4587
4688 obj.RHS = otp .RHS(@(t , y ) otp .cr3bp .f(t , y , mu , soft ), ...
4789 ' Vectorized' , ' on' );
@@ -65,8 +107,21 @@ function onSettingsChanged(obj)
65107 end
66108
67109 function sol = internalSolve(obj , varargin )
68- sol = internalSolve@otp.Problem(obj , ' Solver' , otp .utils .Solver .Nonstiff , varargin{: });
110+ sol = internalSolve@otp.Problem(obj , ...
111+ ' Solver' , otp .utils .Solver .Nonstiff , ...
112+ ' AbsTol' , 1e- 14 , ...
113+ ' RelTol' , 100 * eps , ...
114+ varargin{: });
115+ end
116+
117+ function fig = internalPlotPhaseSpace(obj , t , y , varargin )
118+ mu = obj .Parameters .Mu ;
119+ fig = internalPlotPhaseSpace@otp.Problem(obj , t , y , ...
120+ ' Vars' , 1 : 3 , varargin{: });
121+ hold on ;
122+ scatter3(fig .Children(1 ), [mu , 1 - mu ], [0 , 0 ], [0 , 0 ]);
69123 end
70124
71125 end
126+
72127end
0 commit comments