hannorein / rebound

💫 An open-source multi-purpose N-body code.
https://rebound.readthedocs.io/
GNU General Public License v3.0
820 stars 217 forks source link

New dt calculation for IAS15 #687

Closed dangcpham closed 11 months ago

dangcpham commented 1 year ago

IAS15 old dt calculation method can be slow by giving very pessimistic time steps for certain problems. This new method calculates dt by comparing the second vs. third derivative, naturally giving a timestep:

$$ dt = \frac{y^{(2)}}{y^{(3)}} \cdot \zeta $$

where $\zeta \simeq 6 \times 10^{-2}$ is a constant that can be tuned (but not needed to be fine-tuned).

To use the new method, set sim.ri_ias15.dt_mode=1. The constant $\zeta$ can be set via sim.ri_ias15.zeta, with all the similar caveats as in changing sim.ri_ias15.epsilon.

dangcpham commented 1 year ago

It is now possible to do input/output with ri_ias15.dt_mode and ri_ias15.zeta. Also, backward/forward integration now works (now comparing absolute values of $dt$).

dangcpham commented 1 year ago

Related old parameter $\zeta$ to existing $\epsilon_b$ parameter:

$$ dt = \frac{y^{(2)}}{y^{(3)}} \cdot \zeta \approx \frac{y^{(2)}}{y^{(3)}} \cdot 3 \epsilon_b^{1/7}. $$

The user no longer has to (or able to) specify $\zeta$ directly, but rather can just modify $\epsilon_b$ via r->ri_ias15.epsilon.

hannorein commented 11 months ago

Thanks. I've squashed merged this on the newias branch.