Planetary Orbital Evolution due to Tides
Orbital evolution of two objects experiencing tides
Implementation.md
1 Implementation
2 ==============
3 
4 In order to facilitated modifying or extending the code we provide detailed
5 implementation documentation.
6 
7 The C++ code can be split in five parts:
8 
9  * [Stellar system](\ref StellarSystem_group):
10  describing the star and the planet, including the dependence of
11  non-constant quantities on the system age and other parameters.
12 
13  * [Orbit solver](\ref OrbitSolver_group): implements the steps necessary to
14  calculates the orbital evolution and provides an interface for specifying
15  the problem.
16 
17  * [Utilities](\ref Utilities_group): general utilities useful when defining
18  the stellar system or the orbit solver.
19 
20  * [Unit tests](\ref UnitTests_group): various tests defined to make sure the
21  other parts do what they claim to do.
22 
23 \defgroup StellarSystem_group Stellar System
24 \brief Star-planet system for which the orbital evolution will be calculated.
25 
26 Describes the star and the planet, including:
27 
28  * [Star](\ref Star)
29 
30  * Stellar properties (e.g. radius, moments of inertia, ...) evolving with
31  age.
32 
33  * Frequency dependent tidal dissipation efficiency
34 
35  * Coupled rotational evolution of a radiative core and a convective
36  envelope (for low mass stars only).
37 
38  * Loss of angular momentum due to wind
39 
40  * Having initial surface rotation locked to a proto-planetary disk
41 
42  * [Planet](\ref Planet)
43 
44  * Various orbital properties
45 
46  * Rate of tidal decay and its derivatives with respect to age and system
47  or orbital parameters, as well as the torque exerted on the star due to
48  the tidal dissipation.
49 
50 \defgroup OrbitSolver_group Orbit Solver
51 \brief Calculates the orbital evolution under tides.
52 
53 \section evolution Orbital Evolution
54 
55 The general evolution equations that govern the tidal evolution of a planet
56 around a star in a circular orbit aligned with the stellar rotation are given
57 by:
58 
59 \f{eqnarray}{
60  \frac{da}{dt}&=&\mathrm{sign}(\omega_\mathrm{conv}-\omega_\mathrm{orb})
61  \frac{9}{2}\sqrt{\frac{G}{aM_*}}\left( \frac{R_*}{a}
62  \right)^5\frac{m_p}{Q_*}
63 \\
64  \left(\frac{dL}{dt}\right)_\mathrm{tide}&=&-\frac{1}{2}m_p
65  M_*\sqrt{\frac{G}{a(M_*+m_p)}}\frac{da}{dt}
66 \\
67  \left(\frac{dL}{dt}\right)_\mathrm{wind}&=&
68  -K\omega_\mathrm{conv}
69  \min(\omega_\mathrm{conv}, \omega_\mathrm{sat})^2
70  \left(
71  \frac{R_*}{R_\odot}\right)^{1/2} \left( \frac{M_*}{M_\odot}
72  \right)^{-1/2}
73 \\
74  \frac{dL_\mathrm{conv}}{dt}&=&\frac{\Delta L}{\tau_c} - \frac{2}{3}
75  R_\mathrm{rad}^2
76  \omega_\mathrm{conv} \frac{dM_\mathrm{rad}}{dt} +
77  \left(\frac{dL}{dt}\right)_\mathrm{wind} +
78  \left(\frac{dL}{dt}\right)_\mathrm{tide}
79 \\
80  \frac{dL_\mathrm{rad}}{dt}&=&-\frac{\Delta L}{\tau_c} + \frac{2}{3}
81  R_\mathrm{rad}^2
82  \omega_\mathrm{conv} \frac{dM_\mathrm{rad}}{dt}
83 \\
84  \Delta
85  L&=&\frac{I_\mathrm{conv}L_\mathrm{rad}-
86  I_\mathrm{rad}L_\mathrm{conv}}{I_\mathrm{conv}+I_\mathrm{rad}}
87 \f}
88 
89 Where:
90  * \f$M_*\f$ is the mass of the star
91 
92  * \f$R_*\f$ is the radius of the star
93 
94  * \f$m_p\f$ is the mass of the planet
95 
96  * \f$Q_*\f$ is the tidal quality factor of the star, which is possibly
97  dependent on the tidal frequency
98  (\f$\omega_\mathrm{conv}-\omega_\mathrm{orb}\f$)
99 
100  * \f$\mathrm{sign}(\omega_\mathrm{conv}-\omega_\mathrm{orb})\f$ takes the
101  value 1 when the stellar convective zone is spinning faster than the
102  planet and -1 when the reverse is true
103 
104  * \f$K\f$ is the proportionality constant, parametrizing the strength of
105  the magnetic wind of the star.
106 
107  * \f$\omega_\mathrm{sat}\f$ is the wind saturation frequency
108 
109  * \f$I_\mathrm{conv}\f$ is the moment of inertia of the stellar
110  convective zone
111 
112  * \f$L_\mathrm{conv}\f$ is the angular momentum of the stellar convective
113  zone
114 
115  * \f$I_\mathrm{rad}\f$ is the moment of inertia of the stellar radiative
116  core
117 
118  * \f$L_\mathrm{rad}\f$ is the angular momentum of the stellar radiative
119  core
120 
121  * \f$\tau_c\f$ is the stellar core-envelope coupling timescale
122 
123  * \f$M_\mathrm{rad}\f$ is the mass of the stellar radiative core
124 
125  * \f$R_\mathrm{rad}\f$ is the radius of the radiative-convective boundary
126  in the star
127 
128  * \f$\omega_\mathrm{conv}\equiv L_\mathrm{conv}/I_\mathrm{conv}\f$ is the
129  angular frequency of the stellar convective zone.
130 
131 The following default values for the stellar rotation properties reproduce
132 the present rotation rate of the Sun at the present age:
133  * \f$K=0.35\ \frac{M_{\odot}R_{\odot}^2
134  \mathrm{day}^2}{\mathrm{rad}^2\mathrm{Gyr}}\f$
135  * \f$\omega_\mathrm{sat}=1.84\ \mathrm{rad}/\mathrm{day}\f$
136  * \f$\tau_c=5\ \mathrm{Myr}\f$
137 
138 \section stop_cond Stopping Conditions
139 
140 Because Equations 1 and 3 have discontinuities (when
141 \f$\omega_\mathrm{conv}=\omega_\mathrm{orb}\f$ for equation 1 and when
142 \f$\omega_\mathrm{conv}=\omega_\mathrm{sat}\f$), it is beneficial to detect
143 when the evolution goes through these discontinuities and ensure that it does
144 not simply jump over such points, but lands on them (to some precision of
145 course). Such special treatment of allows the evolution to be calculated both
146 more accurately and more efficientlfy.
147 
148 To see this, consider the discontinuity in Equation 1. Because the sign of
149 the tidal evolution changes when the spin of the star goes through
150 synchroneity with the orbit, it is possible to lock the system in a state
151 where the two quantities are locked to each other. If we simply let the ODE
152 solver handle this for us, it would result in tiny steps being taken,
153 oscillating between super- and sub-synchronous rotation. If we go through the
154 effort of detecting this and stopping the evolution precisely at the point
155 where synchronous rotation is achieved, we can switch to a different system
156 of differential equations that explicitly imposes the spin-orbit lock,
157 getting rid of the oscillatory behavior in the evolution of the semimajor
158 axis.
159 
160 The spin-orbit lock may not persist indefinitely. The orbit continues to
161 evolve since the system is losing angular momentum due to the stellar wind.
162 Because of this, there may come a point when the tidal dissipation in the
163 star cannot drain sufficient amount of angular momentum from the orbit to
164 compensate for the wind loss and the extra spin up required of the star in
165 order to match the shorter orbital period, at which point the evolution has
166 to revert back to the non-locked equations.
167 
168 Next, consider the discontinuity in Equation 3. Because in this case the rate
169 of evolution of the convective angular momentum is not discontinuous, but its
170 derivative is, the ODE solver can blindly jump over the
171 \f$\omega_\mathrm{conv}=\omega_\mathrm{sat}\f$ point resulting in the change
172 from saturated to non-saturated wind (or vice-versa) happening later than it
173 should. If on the other hand, we detect this and force the solver to land
174 precisely on the critical point, the calculated evolution will be more
175 precise.
176 
177 In addition to the above discontinuities, we have several others, which are
178 due to the fact that we may want to include parts of the evolution of the
179 system before and after the planet is present.
180 
181 In the present version of the code, we would like to start the evolution when
182 the protoplanetary disk is still present, assuming that the stellar surface
183 rotation is locked to the rotation rate of the inner edge of the disk. Then
184 at some specified age, the disk is removed (releasing the surface rotation
185 rate of the star from the lock) and replaced with a planet in a circular
186 orbit, whose evolution we then follow to the point when either the star moves
187 off the main-sequenc or the orbit shrinks so much that the planet is tidally
188 destroyed or engulfed by the star. If the planet dies before the star, the
189 angular momentum of the planetary orbit at the moment of death is added to
190 the stellar convective zone and the subseqent rotational evolution of the
191 star is followed until the end of its main sequence phase.
192 
193 Finally, often various applications for which calculating the planet-star
194 orbital evolution is necessary require detecting when some special conditions
195 in the evolution are met.
196 
197 In order to accomplish stopping the evolution when some condition is met,
198 StoppingCondition objects have been introduced. Each Stopping Condition
199 should be a quantity that varies smoothly with the evolution (continuous and
200 continuously differentiable up to at least third order) and is zero exactly
201 when the condition which should stop the evolution is met (see for example
202 SynchronizedCondition, BreakLockCondition, PlanetDeathCondition).
203 
204 It is possible for users to define external stopping conditions. This is
205 accomplished by editing the files ExternalStoppingConditions.h and
206 ExternalStoppingConditions.cpp. The user needs to inherit a class from
207 the #ExternalStoppingCondition class and define operator() for it, which
208 should return a valarray of real values which vary smoothly with age and the
209 orbital parameters and one of which is zero exactly for the evolution states
210 that the evolution needs to meet precisely. If it is known, operator() should
211 also overwrite an input derivatives valarray with the rate at which the
212 stopping condition values change with age (per Gyr). For a more detailed
213 description of the input arguments see #StoppingCondition::operator()().
214 **Recompliing the code is necessary after defining or changing external
215 stopping conditions!**
216 
217 \section modes Evolution Modes
218 
219 As discussed above, discontinuities in the evolution require switching
220 between different systems of differential equations when some
221 StoppingCondition is encountered. The system of differential equations to use
222 at any given time is determined by an evolution mode (#EvolModeType) and the
223 wind saturation state (#WindSaturationState).
224 
225 The wind saturation state only affects how the following quantity is
226 calculated:
227 \f[
228  \left(\frac{dL_\mathrm{conv}}{dt}\right)_\mathrm{wind}=\left\{
229  \begin{array}{l@{\quad\mathrm{if}\quad}l}
230  -K\omega_\mathrm{conv}^3
231  \left(
232  \frac{R_*}{R_\odot}\right)^{1/2} \left( \frac{M_*}{M_\odot}
233  \right)^{-1/2} & \mathrm{NOT\_SATURATED}\\
234  -K\omega_\mathrm{conv}
235  \min(\omega_\mathrm{conv}, \omega_\mathrm{sat})^2
236  \left(
237  \frac{R_*}{R_\odot}\right)^{1/2} \left( \frac{M_*}{M_\odot}
238  \right)^{-1/2} & \mathrm{UNKNOWN}\\
239  -K\omega_\mathrm{conv} \omega_\mathrm{sat}^2
240  \left(
241  \frac{R_*}{R_\odot}\right)^{1/2} \left( \frac{M_*}{M_\odot}
242  \right)^{-1/2} & \mathrm{SATURATED}
243  \end{array}
244  \right.
245 \f]
246 
247 Depending on the evolution mode, the evolution is calculated using different
248 sets of variables and equations governing their evolution.
249 
250 \subsection LOCKED_TO_DISK
251 
252 This is the evolution mode for a system for which the protoplanetary disk is
253 still present. In this case, the spin of the surface convective zone is held
254 at some prescribed constant value \f$\omega_\mathrm{disk}\f$, representing
255 the orbital frequency of the inner edge of the protoplanetary disk, to which
256 the stellar surface rotation is locked.
257 
258 In this case, the only evolution variable is \f$L_\mathrm{rad}\f$ and the
259 equation governing its evolution is:
260 \f{eqnarray}{
261  \frac{dL_\mathrm{rad}}{dt}&=&-\frac{\Delta L}{\tau_c} + \frac{2}{3}
262  R_\mathrm{rad}^2 \omega_\mathrm{conv} \frac{dM_\mathrm{rad}}{dt}
263  \Delta
264 \\
265  L&=&\frac{I_\mathrm{conv}}{I_\mathrm{conv}+I_\mathrm{rad}}
266  \left(L_\mathrm{rad}-I_\mathrm{rad}\omega_\mathrm{disk}\right)
267 \f}
268 
269 The evolution will switch out of this mode at a prescribed disk-dissipation
270 age. The subsequent evolution mode is FAST_PLANET, LOCKED_TO_PLANET or
271 SLOW_PLANET depending on the initial semimajor axis at which the planet
272 appears.
273 
274 \subsection FAST_PLANET
275 
276 This is the evolution mode for a system in which the orbital period is
277 shorter than the spin period of the stellar surface convective zone. In this
278 case the evolution variables are: \f$a^{6.5}\f$, \f$L_\mathrm{conv}\f$,
279 \f$L_\mathrm{rad}\f$, and the equations for their evolution are:
280 
281 \f{eqnarray*}{
282  \frac{da^{6.5}}{dt}&=&
283  -\frac{9}{13}\sqrt{\frac{G}{M_*}}R_*^5\frac{m_p}{Q_*}
284 \\
285  \left(\frac{dL_\mathrm{conv}}{dt}\right)_\mathrm{tide}&=&-\frac{1}{2}m_p
286  M_*\sqrt{\frac{G}{a(M_*+m_p)}}\frac{da}{dt}
287 \\
288  \frac{dL_\mathrm{conv}}{dt}&=&\frac{\Delta L}{\tau_c} - \frac{2}{3}
289  R_\mathrm{rad}^2
290  \omega_\mathrm{conv} \frac{dM_\mathrm{rad}}{dt} +
291  \left(\frac{dL}{dt}\right)_\mathrm{wind} +
292  \left(\frac{dL}{dt}\right)_\mathrm{tide}
293 \\
294  \frac{dL_\mathrm{rad}}{dt}&=&-\frac{\Delta L}{\tau_c} + \frac{2}{3}
295  R_\mathrm{rad}^2
296  \omega_\mathrm{conv} \frac{dM_\mathrm{rad}}{dt}
297 \\
298  \Delta L&=&\frac{I_\mathrm{conv}L_\mathrm{rad}-
299  I_\mathrm{rad}L_\mathrm{conv}}{I_\mathrm{conv}+I_\mathrm{rad}}
300 \f}
301 
302 The reason for using \f$a^{6.5}\f$ instead of \f$a\f$ as the evolution
303 variable is evident from the first equation above. The rate at which
304 \f$a^{6.5}\f$ evolves is independent of \f$a\f$. In fact, for a constant
305 \f$Q_*\f$ it only changes due to \f$R_*\f$ evolving. This allows the ODE
306 solver to take much larger steps when the orbit has shrunk than would
307 otherwise be possible.
308 
309 This evolution mode can end in one of two ways:
310  * The orbit shrinks sufficiently to either be inside the star or inside
311  the critical size when the planet gets destroyed by the tides from the
312  star. In which case the subsequent evolution mode is NO_PLANET.
313  * The spin period of the stellar surface convective zone matches the
314  orbital period. In which case the subsequent evolution mode is either
315  LOCKED_TO_PLANET or SLOW_PLANET, depending on whether the transfer of
316  angular momentum due to tides is sufficient to keep the lock.
317 
318 \subsection LOCKED_TO_PLANET
319 
320 This is the evolution mode for a system in which the surface rotation of the
321 star is held locked to the orbit by the dissipation of the stellar tides. The
322 evolution variables are \f$a\f$ and \f$L_\mathrm{rad}\f$ and the equations:
323 \f{eqnarray*}{
324  \frac{da}{dt}&=&2\frac{T - \dot{I}_\mathrm{conv}/a}
325  {M_*m_p/(M_*+m_p) - 3I_\mathrm{conv}/a^2}
326 \\
327  \left(\frac{dL}{dt}\right)_\mathrm{tide}&=&-\frac{1}{2}m_p
328  M_*\sqrt{\frac{G}{a(M_*+m_p)}}\frac{da}{dt}
329 \\
330  \left(\frac{dL}{dt}\right)_\mathrm{wind}&=&
331  -K\omega_\mathrm{conv}
332  \min(\omega_\mathrm{conv}, \omega_\mathrm{sat})^2
333  \left(
334  \frac{R_*}{R_\odot}\right)^{1/2} \left( \frac{M_*}{M_\odot}
335  \right)^{-1/2}
336 \\
337  \left(\frac{dL}{dt}\right)_\mathrm{coup}&=&
338  \frac{\Delta L}{\tau_c} - \frac{2}{3}
339  R_\mathrm{rad}^2
340  \omega_\mathrm{conv} \frac{dM_\mathrm{rad}}{dt}
341 \\
342  T&=&\frac{a}{(M_*+m_p)G}\left[\left(\frac{dL}{dt}\right)_\mathrm{coup} +
343  \left(\frac{dL}{dt}\right)_\mathrm{wind}\right]
344 \\
345  \frac{dL_\mathrm{conv}}{dt}&=&
346  \left(\frac{dL}{dt}\right)_\mathrm{coup} +
347  \left(\frac{dL}{dt}\right)_\mathrm{wind} +
348  \left(\frac{dL}{dt}\right)_\mathrm{tide}
349 \\
350  \frac{dL_\mathrm{rad}}{dt}&=&-\frac{\Delta L}{\tau_c} + \frac{2}{3}
351  R_\mathrm{rad}^2
352  \omega_\mathrm{conv} \frac{dM_\mathrm{rad}}{dt}
353 \\
354  \Delta
355  L&=&\frac{I_\mathrm{conv}L_\mathrm{rad}-
356  I_\mathrm{rad}L_\mathrm{conv}}{I_\mathrm{conv}+I_\mathrm{rad}}
357 \f}
358 
359 This evolution mode can end either by the planet dying or by the rate of
360 transfer of angular momentum from the orbit to the star falling below what is
361 required to keep the lock. In the first case, the subsequent evolution mode
362 is NO_PLANET and in the other case it is either FAST_PLANET or SLOW_PLANET.
363 
364 \subsection SLOW_PLANET
365 
366 This is the evolution mode for a system in which the orbital period is
367 longer than the spin period of the stellar surface convective zone. In this
368 case the evolution variables are: \f$a^{6.5}\f$, \f$L_\mathrm{conv}\f$,
369 \f$L_\mathrm{rad}\f$, and the equations for their evolution are:
370 
371 \f{eqnarray*}{
372  \frac{da^{6.5}}{dt}&=&
373  \frac{9}{13}\sqrt{\frac{G}{M_*}}R_*^5\frac{m_p}{Q_*}
374 \\
375  \left(\frac{dL_\mathrm{conv}}{dt}\right)_\mathrm{tide}&=&-\frac{1}{2}m_p
376  M_*\sqrt{\frac{G}{a(M_*+m_p)}}\frac{da}{dt}
377 \\
378  \frac{dL_\mathrm{conv}}{dt}&=&\frac{\Delta L}{\tau_c} - \frac{2}{3}
379  R_\mathrm{rad}^2
380  \omega_\mathrm{conv} \frac{dM_\mathrm{rad}}{dt} +
381  \left(\frac{dL}{dt}\right)_\mathrm{wind} +
382  \left(\frac{dL}{dt}\right)_\mathrm{tide}
383 \\
384  \frac{dL_\mathrm{rad}}{dt}&=&-\frac{\Delta L}{\tau_c} + \frac{2}{3}
385  R_\mathrm{rad}^2
386  \omega_\mathrm{conv} \frac{dM_\mathrm{rad}}{dt}
387 \\
388  \Delta L&=&\frac{I_\mathrm{conv}L_\mathrm{rad}-
389  I_\mathrm{rad}L_\mathrm{conv}}{I_\mathrm{conv}+I_\mathrm{rad}}
390 \f}
391 
392 This evolution mode can end only if The spin period of the stellar surface
393 convective zone matches the orbital period. In which case the subsequent
394 evolution mode is either LOCKED_TO_PLANET or FAST_PLANET, depending on
395 whether the transfer of angular momentum due to tides is sufficient to keep
396 the lock.
397 
398 \subsection NO_PLANET
399 
400 This is the evolution mode for a star without a planet in orbit and no
401 proto-planetary disk. Usually this state is reached after the planet dies.
402 The evolution variables are \f$L_\mathrm{conv}\f$ and \f$L_\mathrm{rad}\f$,
403 and their evolution is given by:
404 \f{eqnarray*}{
405  \frac{dL_\mathrm{conv}}{dt}&=&\frac{\Delta L}{\tau_c} - \frac{2}{3}
406  R_\mathrm{rad}^2
407  \omega_\mathrm{conv} \frac{dM_\mathrm{rad}}{dt} +
408  \left(\frac{dL}{dt}\right)_\mathrm{wind}
409 \\
410  \frac{dL_\mathrm{rad}}{dt}&=&-\frac{\Delta L}{\tau_c} + \frac{2}{3}
411  R_\mathrm{rad}^2
412  \omega_\mathrm{conv} \frac{dM_\mathrm{rad}}{dt}
413 \\
414  \Delta
415  L&=&\frac{I_\mathrm{conv}L_\mathrm{rad}-
416  I_\mathrm{rad}L_\mathrm{conv}}{I_\mathrm{conv}+I_\mathrm{rad}}
417 \f}
418 
419 This evolution mode persists until the end of the star's lifetime.
420 
421 \defgroup Utilities_group Utilities
422 \brief General utilities useful when defining the stellar system or
423 the orbit solver.
424 
425 \defgroup UnitTests_group Unit Tests
426 \brief A collection of tests to verify the rest of the code.
427