Verlet Integration to Approximate Planetary Orbit: The First Time Step

644 Views Asked by At

I'm currently working on a simulation of a planet orbiting binary stars, which I want to use Verlet integration to approximate. The formula is as follows:

$\mathbf{p}(t_2) = 2\mathbf{p}(t_1) - \mathbf{p}(t_0) + \Delta t^2 \mathbf{a}(t_1)$

For any timestep OTHER than the first, the process seems reasonably straightforward. In pseudocode:

  • Get $t_1$ position and acceleration
  • Calculate $t_2$ position using $t_1$ and $t_0$ values
  • Store $t_1$ position as $t_0$ position
  • Execute translation and tick forward 1 timestep

However, I'm not sure what to do in this case for the very first timestep, where $t_0$ must be undefined. Do I simply give it the same values as $t_1$? Based on what I've found in my own research, I don't think that's correct, but all the information I've been able to find on Verlet has been a bit over my head, and often in different contexts. If anyone could provide a straightforward explanation for how I'm supposed to handle the first timestep in this scenario, I'd greatly appreciate it.

1

There are 1 best solutions below

0
On BEST ANSWER

If you want to use the Verlet algorithm, I'd recommend the "velocity Verlet" version, which is based on positions $\mathbf{p}$ and velocities $\mathbf{v}$. You start by specifying $\mathbf{p}(t_0)$ and $\mathbf{v}(t_0)$. Then at each step $$ \mathbf{p}(t_{n+1}) = \mathbf{p}(t_n) + \mathbf{v}(t_n) \Delta t + \tfrac{1}{2}\mathbf{a}(t_n) \Delta t^2 $$ then calculate $\mathbf{a}(t_{n+1})$ and $$ \mathbf{v}(t_{n+1}) = \mathbf{v}(t_n) + \tfrac{1}{2}[\mathbf{a}(t_n)+\mathbf{a}(t_{n+1})] \Delta t $$ This eliminates the problem at the start (although you need to choose an initial velocity). It is possible to show that this is equivalent to the original Verlet formula. Various slightly different formulations of velocity Verlet can be found on the Wikipedia page.