next previous
Up: SPH simulations of clumps


  
Appendix B: Modified leapfrog

Consider first the synchronized solutions, ${\vec x}_{_n}$, ${\vec v}_{_n}$, for positions and velocities, respectively, at the cycle n of time integration (instant tn). Suppose that the old leapfrog-positions ${\vec x}_{_{n-1/2}}$, reached from the instant tn to instant tn-1/2, is receding by a half time-step $0.5\tau_{_{n-1/2}}$, where $\tau_{_{n-1/2}}$is a given time-step to advance positions from time-level n-1/2 to n+1/2. This time-step was estimated at time-level n-1/2, obeying some stability condition (e.g. Hilbert-Courant instability conditions).

From the above considerations, we have the following second-order approximation for positions at time-level n from time-level n-1/2:


 \begin{displaymath}{\vec x}_{_n}
\approx
{\vec x}_{_{n-1/2}}
+{1\over 2}\tau_{_{...
...{\vec v}_{_n}
-{1\over 8}\tau_{_{n-1/2}}^2{\vec a}_{_{n-1/2}},
\end{displaymath} (B1)

where ${\vec a}_{_{n-1/2}}$ is the particle acceleration which depends in general on positions ( ${\vec x}_{_{n-1/2}}$) and position-synchronized velocities ( ${\vec v}_{_n-1/2}$).

Second, consider the final leapfrog-positions, ${\vec x}_{_{n+1/2}}$, obtained from the initial solution ${\vec x}_{_n}$ advancing from time-level n to n+1/2 by a half time-step, $\tau_{_{n+1/2}}$, yielded at time-level n+1/2:


 \begin{displaymath}{\vec x}_{_{n+1/2}}
\approx
{\vec x}_{_n}
+{1\over 2}\tau_{_{...
...{\vec v}_{_n}
+{1\over 8}\tau_{_{n+1/2}}^2{\vec a}_{_{n-1/2}}.
\end{displaymath} (B2)

Adding the respective members of Eqs. (B1) and (B2), and then simplifying, we have the modified second-order leapfrog scheme for positions:


 \begin{displaymath}{\vec x}_{_{n+1/2}}
\approx
{\vec x}_{_{n-1/2}}
+\bar\tau{\vec v}_{_n}
+\bar\tau\delta\tau{\vec a}_{_{n-1/2}},
\end{displaymath} (B3)

where


 \begin{displaymath}\bar\tau\equiv 0.5(\tau_{_{n+1/2}}+\tau_{_{n-1/2}}),
\end{displaymath} (B4)

and


 \begin{displaymath}\delta\tau\equiv 0.25(\tau_{_{n+1/2}}-\tau_{_{n-1/2}}).
\end{displaymath} (B5)

Velocities are integrated from time-level n to n+1, which is divided into the two steps: integrating with the same half time-step, $0.5\tau_{_{n+1/2}}$, from n to n+1/2, and from n+1/2 to n+1. After some algebra, this procedure results in the following second-order leapfrog-scheme for velocities:


 \begin{displaymath}{\vec v}_{_{n+1}}=
{\vec v}_{_n}
+\tau_{_{n+1/2}}{\vec a}_{_{n+1/2}}.
\end{displaymath} (B6)

Time centered velocities may be estimated with the following first-order approximation:


 \begin{displaymath}{\vec v}_{_{n+1/2}}=
0.5({\vec v}_{_{n+1}}+{\vec v}_{_n}),
\end{displaymath} (B7)

which propagates third-order error to the overall leapfrog fluid equations.

Thermal energies, or any other physical quantity obeying a first order differential equation of motion (e.g., magnetic field), may be advanced with an implicit second order scheme. Since specific thermal energy rate, $\dot u_i$, depends implicitly on particle's position and velocity, ( ${\vec x}_i$, ${\vec v}_i$), it is quite convenient to synchronize thermal energies with positions. Velocity terms in quantities like the velocity-divergence, artificial viscosity etc. shall be time-centered via Eq. (B7).

Considering the initial solutions for the specific thermal energy and specific thermal energy rate to be un-1/2 and $\dot u_{_{n-1/2}}$ respectively. Time-centered solutions may be obtained by integrating from time-level n-1/2 to n, and receding the final solutions from time-level n+1/2 to n. Both solutions can be written in a second order approximation:


 \begin{displaymath}u_{_n}\approx
u_{_{n-1/2}}
+{1\over 2}\tau_{_{n-1/2}}\dot u_{_{n-1/2}}
+{1\over 8}\tau_{_{n-1/2}}^2\ddot u_{_n},
\end{displaymath} (B8)

and


 \begin{displaymath}u_{_n}\approx
u_{_{n+1/2}}
-{1\over 2}\tau_{_{n+1/2}}\dot u_{_{n+1/2}}
+{1\over 8}\tau_{_{n+1/2}}^2\ddot u_{_n}.
\end{displaymath} (B9)

Subtracting the respective members of Eq. (B8) from Eq. (B9), we find

\begin{displaymath}u_{_{n+1/2}}=
u_{_{n-1/2}}
+{1\over 2}
\biggl\{
\tau_{_{n+1/2}}\dot u_{_{n+1/2}}
+\tau_{_{n-1/2}}\dot u_{_{n-1/2}}
\end{displaymath}


 \begin{displaymath}\;\;\;\;\;\;
-{1\over 4}(\tau_{_{n+1/2}}^2-\tau_{_{n-1/2}}^2)\ddot u_{_{n}}
\biggr\}\cdot
\end{displaymath} (B10)

Analogously, we find $\dot u_{_n}\approx\dot u_{_{n-1/2}}+0.5\tau_{_{n-1/2}}\ddot u_{_{n}}$ and $\dot u_{_n}\approx\dot u_{_{n+1/2}}+{1\over 2}\tau_{_{n+1/2}}\ddot u_{_{n}}$, from which we may extract the second derivative:


 \begin{displaymath}\ddot u_{_n}={\dot u_{_{n+1/2}}-\dot u_{_{n-1/2}}\over0.5(\tau_{_{n+1/2}}+\tau_{_{n-1/2}})}.
\end{displaymath} (B11)

Substituting $\ddot u_{_n}$ from Eq. (B11) in Eq. (B10), and after some simplifications, we have the following difference-scheme:


\begin{displaymath}u_{_{n{+}1/2}}{=}
u_{_{n{-}1/2}}
{+}0.25(\tau_{_{n{+}1/2}}{+}\tau_{_{n{-}1/2}})(\dot u_{_{n{+}1/2}}{+}\dot u_{_{n{-}1/2}}).
\end{displaymath} (B12)


next previous
Up: SPH simulations of clumps

Copyright The European Southern Observatory (ESO)