8. Numerical Resonance Models¶
8.1. Introduction¶
Approximate equations of motion governing the dynamics of a mean motion
resonance can be generated by including terms from a distrubing function
expansion using the PoincareHamiltonian
class.
However, celmech
also allows users to derive equations governing mean
motion resonance dynamics without resorting to a truncated Taylor expansions in
eccentricities and inclinations. celmech provides two such classes,
PlanarResonanceEquations
and
SpatialResonanceEquations
, are
described below.
8.2. Planar Resonance Equations¶
The PlanarResonanceEquations
class
provides equations of motion governing a \(j\mathrm{:}j-k\) mean-motion
resonance between two coplanar planets. In order to do so, the class first
constructs a numerical Hamiltonian governing the system by means of numerical
integration.
8.2.1. Introduction¶
Starting from the full 3-body Hamiltonian governing a pair of planar planets,
the first step in constructing this Hamiltonian is to perform a canonical transformation to new canonical coordinates
where \(s = (j-k)/{k}\), along with new conjugate momenta defined implicitly in terms of the old momentum variables as
Conservation of angular momentum implies that the quantity
conjugate to the angle \(l\), is conserved
Next, we separate \(H_\mathrm{int}\) into two pieces,
The PlanarResonanceEquations
class then
models the dynamics of the resonant Hamiltonian,
where \(P\) is now a conserved quantity because \({\cal H}_\mathrm{res}\) is independent of the coordinate \(Q\).
8.2.2. Units and Dynamical Variables¶
As written, \({\cal H}_\mathrm{res}(\sigma_i,I_i;P , L)\) represents a two
degree-of-freedom system that depends on two parameters \(P \mathrm{ and }
L\) (in addition to the planets’ and star’s masses). The
PlanarResonanceEquations
class reduces
the number of free parameters by selecting appropriate units for action
variables and time. In particular, the units are chosen by first defining the
reference semi-major axes, \(a_{i,0}\), so that
Next, the action variables are rescaled by
and time is measured in units such that
\(\sqrt{\frac{GM_*}{a_{2,0}^{3}}}=1\) (i.e., the orbital period at
\(a=a_{2,0}\) is equal to \(2\pi\)). Finally, rather than specifying
the conserved quantity \(P\), the equations of motion used by
PlanarResonanceEquations
are formulated
in terms of
where \(\Lambda_{i,0} = \tilde{m}_i \sqrt{G\tilde{M}_ia_{i,0}}\). In terms of orbital elements,
where \(\Delta = \frac{j-k}{j}\frac{P_2}{P_1} - 1\), \(\beta_i = \frac{\tilde{m}_i}{\tilde{m}_1+\tilde{m}_2}\sqrt{\frac{\tilde{M}_i}{M_*}}\) and \(\alpha_0 = \frac{a_{1,0}}{a_{2,0}}\).
Finally, PlanarResonanceEquations
uses canonical
coordinate \(y_i = \sqrt{2I_i}\sin\sigma_i\) and conjugate momenta
\(x_i = \sqrt{2I_i}\cos\sigma_i\) instead of \((\sigma_i,I_i)\) in
order to formulate the equations of motion.
Various methods of the PlanarResonanceEquations
class take
dynamical variables as a vector in the standardized form:
when computing equations of motion and other quantities.
8.2.3. Dissipative Forces¶
The
PlanarResonanceEquations
class includes capabilities to model dissipative forces inducing migration and eccentricity damping in addition to the conservative dynamics of resonant interactions. Specifically, migration forces of the form
These forces are specified by setting the attributes K1
, K2
, p
, and
tau_alpha
.
8.3. Spatial Resonance Equations¶
The SpatialResonanceEquations
class provides equations of motion governing a mean-motion resonance between a
planet pair on mutually inclined orbits. To study the dynamics of a
\(j:j-k\) MMR, we will perform a canonical transformation from the usual
Poincare canonical variables to new canonical variables as in
the planar case above. However, before proceeding with this transformation, we
follow Malige (2002) and use the
invariance of the system’s angular momentum vector direction to reduce the
number of degrees of freedom by one. This reduction is accomplished by first
adopting a coordinate system in which the system’s angular momentum vector lies
along the \(z\)-axis. Next, complex canonical variables
\(y_i=\sqrt{Q_i}e^{-\mathrm{i} q_i}\) are introduced and the reduced
Hamiltonian is written by replacing the complex canonical variables \(y_i\)
with the expressions
which introduce the new complex canonical variable \(y\). Finally, the new canonical variable \(y\) can be written as \(y=\sqrt{Q}e^{-\mathrm{i}q}\), introducing the canonical coordinate-momentum pair \((q,Q)\). In terms of orbital elements, the new variables are
and \(q=-\frac{1}{2}(\Omega_1+\Omega_2)\).
Now we introduce the new canonical angle variables
where \(s = (j-k)/{k}\), along with their conjugate action variables
\[\begin{split}\begin{align} \begin{pmatrix}I_1 \\ I_2 \\ \Phi \\ \Psi \\ L \end{pmatrix} = \begin{pmatrix} 0 & 0 & 1 & 0 & 0 \\ 0 & 0 & 0 & 1 & 0 \\ 0 & 0 & 0 & 0 & 1 \\ -j & k-j & 0 & 0 & 0 \\ 1 & 1 & -1 & -1 & -1 \end{pmatrix} \cdot \begin{pmatrix}\Lambda_1 \\ \Lambda_2 \\ \Gamma_1 \\ \Gamma_2 \\ Q \end{pmatrix}~. \label{eq:equations_of_motion:new_actions} \end{align}\end{split}\]
After this canonical transformation, the Hamiltonian is independent of the angle variables \(l\) so the quantity
is conserved, reflecting the conservation of the system’s total angular
momentum. The phase space is further reduced by numerically averaging over the
fast angle \(\psi\), similar to the
PlanarResonanceEquations
class. We also eliminate the explicit dependence of our equations of motion on
the value of the total angular momentum by introducing a simultaneous
re-scaling of the Hamiltonian and the action variables that preserves the form
of Hamilton’s equations. In order to do so, let us first define the reference
semi-major axes \(a_{1,0}\) and \(a_{2,0}\) such that
and
In other words, \(a_{1,0}\) is defined as the nominal location of an exact resonance with a planet situated at \(a_{2,0}\). We then re-scale the Hamiltonian and the action variable, dividing each by a factor of \((\mu_1 + \mu_2)\sqrt{GM_*a_{2,0}}\) so that the new Hamiltonian and canonical action variables are given by
and the re-scaled angular momentum, \({L}= \beta_2 + \beta_1\sqrt{a_{1,0}/a_{2,0}}\), is a constant. In terms of the newly re-scaled variables, the averaged Hamiltonian is then
where
with \(\beta_i=\frac{\mu_i}{\mu_1+\mu_2}\sqrt{1+m_i/M_*}\), \(n_{2,0} = \sqrt{GM_*a_{2,0}^{-3}}\), \(\epsilon = \frac{m_1m_2}{M_*(\mu_1+\mu_2)}\), and
In order to avoid coordinate singularities that occur when \(I_i=0\) or
\(\Phi=0\), the
SpatialResonanceEquations
class
formulates the Hamiltonian in terms of the canonical variables
Because the averaged Hamiltonian is independent of the angle variable \(\psi\), the action variable \(\Psi\) is a constant of motion. Rather than parameterizing the Hamiltonian in terms of \(\Psi\), we introduce a variable \({\cal D}\) that has a more straightforward interpretation as the “average” angular momentum deficit of the resonant planet pair. In order to define \({\cal D}\), let us first introduce \(\rho_\mathrm{res}\) as the value of \({\Lambda}_1/{\Lambda}_2\) when the planet pair’s period ratio is equal to the nominal resonant period ratio. Explicitly, \(\rho_\mathrm{res} = \frac{\beta_1}{\beta_2}\left(\frac{j-k}{j}\right)^{1/3}\left(\frac{M_1}{M_2}\right)^{1/6}\). Then, we define \({\cal D}\), along with an additional constant \(\Lambda_{2,\mathrm{res}}\), such that
Inverting this equation and solving for \(\mathcal{D}\) yields
We express \(\mathcal{D}\) in terms of the planet pair’s period ratio by using
allowing us to write
In other words, \(\mathcal{D}\) sets the value of the pair’s angular momentum deficit when the planets’ period ratio is at the exact resonant value (\(\Delta=0\)).
8.4. API¶
- class celmech.numerical_resonance_models.PlanarResonanceEquations(j, k, n_quad_pts=40, m1=1e-05, m2=1e-05, K1=100, K2=100, tau_alpha=100000.0, p=1)[source]¶
A class for the model describing the dynamics of a pair of planar planets in/near a mean motion resonance.
Includes the effects of dissipation.
- tau_alpha¶
Migration timescale defined by \(\tau_\alpha^{-1} =\tau_{m,2}^{-1} - \tau_{m,1}^{-1}\)
- Type
- K1¶
Ratio of inner planet eccentricity damping timescale to migration timescale, tau_alpha.
- Type
- K2¶
Ratio of outer planet eccentricity damping timescale to migration timescale, tau_alpha.
- Type
- p¶
Sets coupling between eccentricity damping and semi-major axis damping so that
\[\frac{d}{dt}a_i = -a_i/\tau_{m,i} - 2pe_i^2/\tau_{e,i}\]A value of p=1 corresponds to eccentricity damping at constant angular momentum.
- Type
- timescales¶
Dictionary containing the migration and eccentricity damping time-scales of the inner and outer planets based on the damping parameters of the resonance model.
- Type
- H(z)[source]¶
Calculate the value of the Hamiltonian.
- Parameters
z (ndarray) – Dynamical variables
- Returns
The value of the Hamiltonian evaluated at z.
- Return type
- H_flow(z)[source]¶
Calculate flow induced by the Hamiltonian
\[\dot{z} = \Omega \cdot \nabla_{z}H(z)\]- Parameters
z (ndarray) – Dynamical variables
- Returns
Flow vector
- Return type
ndarray
- H_flow_jac(z)[source]¶
Calculate the Jacobian of the flow induced by the Hamiltonian
\[\Omega \cdot \Delta H(z)\]- Parameters
z (ndarray) – Dynamical variables
- Returns
Jacobian matrix
- Return type
ndarray
- H_kep(z)[source]¶
Calculate the value of the Keplerian component of the Hamiltonian.
- Parameters
z (ndarray) – Dynamical variables
- Returns
The value of the Keplerian part of the Hamiltonian evaluated at z.
- Return type
- H_kep_flow(z)[source]¶
Calculate the flow vector generated by the Keplerian component of the Hamiltonian.
- Parameters
z (ndarray) – Dynamical variables
- Returns
The flow vector of the Keplerian component of the Hamiltonian
- Return type
ndarray
- H_pert(z)[source]¶
Calculate the value of the perturbation component of the Hamiltonian.
- Parameters
z (ndarray) – Dynamical variables
- Returns
The value of the perturbation part of the Hamiltonian evaluated at z.
- Return type
- H_pert_flow(z)[source]¶
Calculate the flow vector generated by the perturbation component of the Hamiltonian.
- Parameters
z (ndarray) – Dynamical variables
- Returns
The flow vector generated by the perturbation part of the Hamiltonian evaluated at z.
- Return type
ndarray
- H_pert_full(psi, z)[source]¶
Calculate the value of the perturbation component of the full, unaveraged Hamiltonian.
- H_pert_osc(psi, z)[source]¶
Calculate the oscillating part of value of the perturbation component of the unaveraged Hamiltonian.
- dyvars_from_rebound_simulation(sim, iIn=1, iOut=2, osculating_correction=False)[source]¶
Convert dynamical variables
to a Rebound simulation.
- Parameters
sim (rebound.Simulation) – Simulation object to
iIn (int, optional) – Integer index of inner planet to use for computing dynamical variables. Default is 1
iOut (int, optional) – Integer index of outer planet to use for computing dynamical variables. Default is 2
osculating_correction (boole, optional) – If True, correct the orbital elements of the rebound simulation by transforming to the mean variables of the resonance model.
- Returns
z – Dynamical variables
- Return type
ndarray
- dyvars_to_Poincare_actions(dyvars)[source]¶
Convert a set of dynamical variables to Poincare actions
- Parameters
dyvars (ndarray) – Dynamical variables to convert
- Returns
actions – Poincare actions stored as dictionary entries.
- Return type
- dyvars_to_orbital_elements(z)[source]¶
Convert dynamical variables
\[z = (y_1,y_2,x_1,x_2,{\cal D})\]to orbital elements
\[(a_1,e_1,\theta_1,a_2,e_2,\theta_2)\]
- dyvars_to_rebound_simulation(z, Q=0, pomega1=0, osculating_correction=True, include_dissipation=False, **kwargs)[source]¶
Convert dynamical variables
\[z = (y_1,y_2,x_1,x_2,{\cal D}\]to a Rebound simulation.
- Parameters
z (ndarray) – Dynamical variables
pomega1 (float, optional) – Planet 1’s longitude of periapse. Default is 0
Q (float, optional) – Angle variable Q = (lambda2-lambda1) / k. Default is Q=0. Resonant periodic orbits are 2pi-periodic in Q.
osculating_correction (bool, optional) – If True, apply correction from the ‘averaged’ variables employed by the resonance model to osculating variables used in the un-averaged three-body problem. Correction is done to first order in planet masses and assumes that the system is near an equilibrium configuration of the resonance model. Default is True.
include_dissipation (bool, optional) – Include dissipative effects through reboundx’s external forces. Default is False
- Keyword Arguments
inc (float, default = 0.0) – Inclination of planets’ orbits.
- Returns
Returns a tuple. The first item of the tuple is a rebound simulation. The second item is a reboundx.Extras object if ‘include_dissipation’ is True, otherwise the second item is None.
- Return type
- find_equilibrium(guess, dissipation=False, tolerance=1e-09, max_iter=10)[source]¶
Use Newton’s method to locate an equilibrium solution of the equations of motion.
By default, an equilibrium of the dissipation-free equations is sought. In this case, the AMD value of the equilibrium solution will be equal to the value of the initially supplied guess of dynamical variables. If dissipative terms are included then the equilibrium will depend on the parameters K1 and K2 as well as tau_alpha.
- Parameters
guess (ndarray) – Initial guess for the dynamical variables at the equilibrium.
dissipation (bool, optional) – Whether dissipative terms are considered in the equations of motion. Default is False.
tolerance (float, optional) – Tolerance for root-finding such that solution satisfies \(|f(z)|\) < tolerance Default value is 1E-9.
max_iter (int, optional) – Maximum number of Newton’s method iterations. Default is 10. If maximum is reached, result will be returned with a warning.
include_dissipation (bool, optional) – Include dissipative terms in the equations of motion. Default is False
- Returns
zeq – Equilibrium value of dynamical variables.
- Return type
ndarray
- flow(z)[source]¶
Calculate the flow vector of the equations of motion
\[\dot{z} = \Omega \cdot \nabla_{z}H(z) + f_{dis}(z)\]- Parameters
z (ndarray) – Dynamical variables
- Returns
Flow vector
- Return type
ndarray
- flow_jac(z)[source]¶
Calculate the Jacobian of the equations of motion given by
\[\Omega \cdot \Delta H(z) + \nabla f_{dis}(z)\]- Parameters
z (ndarray) – Dynamical variables
- Returns
Jacobian matrix
- Return type
ndarray
- grad_H_pert_full(psi, z)[source]¶
Calculate the gradient of the perturbation component of the full, unaveraged Hamiltonian with respect to variables \(z\).
- Parameters
psi (float) –
Angle variable
\[(\lambda_2-\lambda_1)/k\]z (ndarray) – Dynamical variables
- Returns
grad – The gradient the perturbation part of the Hamiltonian with respect to \(z\) evaluated at \((\psi,z)\).
- Return type
ndarray
- grad_omega_syn(z)[source]¶
Calculate the gradient of the synodic frequency,
\[\nabla_{\pmb{z}} \omega_{syn}\]as a function of dynamical variables \(\pmb{z}\)
- Parameters
z (ndarray) – Dynamical variables
- Returns
Synodic frequency
- Return type
- integrate_initial_conditions(dyvars0, times, dissipation=False)[source]¶
Integrate initial conditions and calculate dynamical variables and orbital elements at specified times.
Integration is done with the scipy.integrate.odeint method.
- Parameters
dyvars0 (ndarray) – Initial conditions in the form of an array of dynamical variables.
times (ndarray) – Times at which to calculate output.
- Returns
soln – Dictionary containing both the dynamical variables and the orbital elements of the integrated solution. The dictionary keys are - ‘times’: Times at which solutin is computed. - ‘dynamical_variables’: ndarray of dynamical at each of the times in ‘times’. - ‘orbital_elements’: dict containing arrays of the various orbital elements.
- Return type
- mean_to_osculating_dyvars(Q, z, N=256)[source]¶
Apply perturbation theory to transfrom from the phase space coordiantes of the averaged model to osculating phase space coordintates of the full phase space. Assumes that the transformation is being applied at the fixed point of the averaged model. Details are described in the appendix of Hadden & Payne (2020)
8. Arguemnts¶
- Qfloat or ndarry
Value(s) of angle \(Q=(lambda2-lambda1)/k\) at which to apply transformation. Equilibrium points of the averaged model correspond to orbits that are periodic in Q in the full phase space.
- zndarray
Dynamical variables of the averaged model, math::z = (y_1,y_2,x_1,x_2,{cal D})
- Nint, optional
Number of Q points to evaluate functions at when performing Fourier transformation. Default is N=256
- returns
zosc – The osculating values of the dynamical varaibles for the input Q values. The dimension of the returned variables is set by the dimension of the input ‘Q’. If Q is a float, then z is an array of length 5. If Q is an array of length M then zosc is an (M,5) array.
- rtype
ndarray, (5,) or (M,5)
- class celmech.numerical_resonance_models.SpatialResonanceEquations(j, k, n_quad_pts=40, m1=1e-05, m2=1e-05)[source]¶
A class for equations describing the dynamics of a pair of planets in/near a mean motion resonance.
- H(z)[source]¶
Calculate the value of the Hamiltonian.
- Parameters
z (ndarray) – Dynamical variables
- Returns
The value of the Hamiltonian evaluated at z.
- Return type
- H_flow(z)[source]¶
Calculate flow induced by the Hamiltonian
\[\dot{z} = \Omega \cdot \nabla_{z}H(z)\]- Parameters
z (ndarray) – Dynamical variables
- Returns
Flow vector
- Return type
ndarray
- H_flow_jac(z)[source]¶
Calculate the Jacobian of the flow induced by the Hamiltonian
\[\Omega \cdot \Delta H(z)\]- Parameters
z (ndarray) – Dynamical variables
- Returns
Jacobian matrix
- Return type
ndarray
- H_kep(z)[source]¶
Calculate the value of the Keplerian component of the Hamiltonian.
- Parameters
z (ndarray) – Dynamical variables
- Returns
The value of the Keplerian part of the Hamiltonian evaluated at z.
- Return type
- H_pert(z)[source]¶
Calculate the value of the perturbation component of the Hamiltonian.
- Parameters
z (ndarray) – Dynamical variables
- Returns
The value of the perturbation part of the Hamiltonian evaluated at z.
- Return type
- dyvars_from_rebound_simulation(sim, iIn=1, iOut=2, osculating_correction=False, full_output=False)[source]¶
Convert rebound simulation to dynamical variables.
- Parameters
sim (rebound.Simulation) – Simulation object
iIn (int, optional) – Index of inner planet in simulation particles list. Default is 1.
iOut (int, optional) – Index of outer planet in simulation particles list. Default is 2.
osculating_correction (boole, optional) – If True, correct the orbital elements of the rebound simulation by transforming to the mean variables of the resonance model. Default is False.
full_output (boole, optional) – Return a dictionary containing the re-scaling factors from time and distance units of the input simulation to the time and distance units used by SpatialResonanceEquations.
- Returns
z (ndarray) – Dynamical variables for resonance equations of motion.
scales (dict, optional) – Returned if ‘full_output’ is True. ‘scales’ contains conversion factors from simulation to resonance equation units such that:
distance_sim = scales[‘distance’] * distance_eqs time_sim = scales[‘time’] * time_eqs
- dyvars_to_Poincare_actions(z)[source]¶
Convert dynamical variables .. math:
z = (y1,y2,yinc,x1,x2,xinc,amd)
to canonical Poincare action variables .. math:
(L1,L2,Gamma1,Gamma2,Q1,Q2)
- Parameters
z (ndarray) – Dynamical variables
- Returns
Dictionary of canonical actions with strings as keys.
- Return type
- dyvars_to_orbital_elements(z)[source]¶
Convert dynamical variables .. math:
z = (y_1,y_2,y_inc,x_1,x_2,y_inc,{cal D})
to orbital elements .. math:
(a_1,e_1,inc_1,theta_1,a_2,e_2,inc_2,theta_2)
- dyvars_to_rebound_simulation(z, psi=0, Omega=0, osculating_correction=True, include_dissipation=False, **kwargs)[source]¶
Convert dynamical variables to a Rebound simulation.
- Parameters
z (ndarray) – Dynamical variables
Omega (float, optional) – Value of cyclic coordinate Omega
psi (float, optional) – Angle variable psi = (lambda1-lambda2) / k. Default is psi=0. Resonant periodic orbits are 2pi-periodic in Q.
include_dissipation (bool, optional) – Include dissipative effects through reboundx’s external forces. Default is False
- Keyword Arguments
- Returns
Returns a tuple. The first item of the tuple is a rebound simulation. The second item is a reboundx.Extras object if ‘include_dissipation’ is True, otherwise the second item is None.
- Return type
- integrate_initial_conditions(dyvars0, times)[source]¶
Integrate initial conditions and calculate dynamical variables and orbital elements at specified times.
Integration is done with the scipy.integrate.odeint method.
- Parameters
dyvars0 (ndarray) – Initial conditions in the form of an array of dynamical variables.
times (ndarray) – Times at which to calculate output.
- mean_to_osculating_dyvars(psi, z, N=256)[source]¶
Apply perturbation theory to transfrom from the phase space coordiantes of the averaged model to osculating phase space coordintates of the full phase space.
Assumes that the transformation is being applied at the fixed point of the averaged model.
8. Arguemnts¶
- Qfloat or ndarry
Value(s) of angle (lambda2-lambda1)/k at which to apply transformation. Equilibrium points of the averaged model correspond to orbits that are periodic in Q in the full phase space.
- zndarray
Dynamical variables of the averaged model, \(z = (y_1,y_2,y_I,x_1,x_2,x_I,\mathcal{D})\)
- Nint, optional
Number of Q points to evaluate functions at when performing Fourier transformation. Default is N=256
- returns
zosc – The osculating values of the dynamical varaibles for the input Q values. The dimension of the returned variables is set by the dimension of the input ‘Q’. If Q is a float, then z is an array of length 5. If Q is an array of length M then zosc is an (M,5) array.
- rtype
ndarray, (7,) or (M,7)