Pendulum - N-body pendulum simulator

Discretisation

Normalisation

As derived in the governing equation, there are \(2 N\) unknowns

\[ \begin{align}\begin{aligned}& \vel_{0}, \vel_{1}, \cdots, \vel_{N - 2}, \vel_{N - 1},\\& \pos_{0}, \pos_{1}, \cdots, \pos_{N - 2}, \pos_{N - 1},\end{aligned}\end{align} \]

and \(2 N\) equations:

\[ \begin{align}\begin{aligned}& \tder{\pos_{\ia}}{t} = \vel_{\ia},\\& \lag = 0_{\ia}.\end{aligned}\end{align} \]

In addition to the fact that the equations being \(m\)-independent, I normalise these equations by the reference length scale \(l\) and by the reference time scale \(\sqrt{l / g}\), giving

\[ \begin{align}\begin{aligned}& \tder{\pos_{\ia}}{t} = \vel_{\ia},\\& \sum_{\ib = 0}^{N - 1} \left\{ N - \max \left( \ia, \ib \right) \right\} \tder{\vel_{\ib}}{t} \cos \left( \pos_{\ia} - \pos_{\ib} \right) + \sum_{\ib = 0}^{N - 1} \left\{ N - \max \left( \ia, \ib \right) \right\} \vel_{\ib} \vel_{\ib} \sin \left( \pos_{\ia} - \pos_{\ib} \right) - \left( N - \ia \right) \cos \pos_{\ia} = 0_{\ia},\end{aligned}\end{align} \]

which are treated in the following part.

Scheme

The simplest scheme would be:

\[ \begin{align}\begin{aligned}& \dder{\pos_{\ia}}{t} = \vel_{\ia}^{n+1},\\& \sum_{\ib = 0}^{N - 1} \left\{ N - \max \left( \ia, \ib \right) \right\} \dder{\vel_{\ib}}{t} \cos \left( \pos_{\ia}^n - \pos_{\ib}^n \right) = \left( N - \ia \right) \cos \pos_{\ia}^n - \sum_{\ib = 0}^{N - 1} \left\{ N - \max \left( \ia, \ib \right) \right\} \vel_{\ib}^n \vel_{\ib}^n \sin \left( \pos_{\ia}^n - \pos_{\ib}^n \right),\end{aligned}\end{align} \]

which requests to solve only one linear system.

This scheme, however, does not satisfy the energy conservation in general (see Example).

The first part is devoted to find a proper scheme which is discretely energy-conserving, which is followed by the concrete numerical treatment.