Skip to content
/ MSDPS Public

Modelling Single & Double Pendulum Systems (MSDPS) - Using finite difference methods for solving ordinary differential equations

License

Notifications You must be signed in to change notification settings

Songyosk/MSDPS

Repository files navigation

Modelling Single & Double Pendulum Systems (MSDPS)

Using finite difference methods for solving ordinary differential equations

DOI

Introduction

The dynamics of a single pendulum and a double pendulum were computationally examined to analyse different finite difference methods for solving ordinary differential equations (ODEs). The fourth-order Runge-Kutta (RK4) was found to be the most suitable method considering the stability and the accuracy it can provide when solving general oscillatory problems. Subsequently, RK4 was employed to model the dynamics of a double pendulum. This yielded the understanding of the motion and the variation of the energy over time from which the dependence of the system on the initial conditions and the limitations of RK4 could be inferred.

Requirements

Python 2.x is required to run the scripts (except for those with name beginning with 'ODE_').

Create an environment using conda as follows:

  conda create -n python2 python=2.x

Then activate the new environment by:

  conda activate python2

Python 3.x is required to run the scripts whose name begins with 'ODE_'. These scripts are Python 3.x version of 'Project A - Single.py' and 'Project A - Double.py'.

Create an environment using conda as follows:

  conda create -n python3 python=3.x

Then activate the new environment by:

  conda activate python3

Results

  • Single Pendulum

FIG1AmpvsT4noDamping

Figure 1: Dynamics of an undamped single pendulum using different FDMs. This illustrates the oscillations predicted by Leapfrog and RK4 are periodic with relatively constant amplitude. In contrast, the oscillations are becoming unbound over time for explicit Euler, whereas it appears to be converging for implicit Euler


FIG2EvsT4noDamping

Figure 2: The change in the total energy over time for an undamped single pendulum using the same parameters as in FIG. 1. Without damping, the law of energy conservation states that the total energy should be constant. However, the total energy is increasing and decreasing for explicit and implicit Euler, respectively.


FIG3AmpvsT4Damping

Figure 3: Dynamics of a damped (D = 0.2) single pendulum with parameters. This illustrates that the oscillations predicted by RK4, explicit and implicit Euler are converging with time. The oscillations model by the Leapfrog method appears to converge initially. However, it becomes unbound at higher t.


FIG4EvsT4Damping

Figure 4: The change in the total energy over time for a damped single pendulum using the same parameters as in FIG. 3. With damping, the law of energy conservation states that the total energy should decrease. This is true for FDMs except Leapfrog, where the total energy is decreasing at the beginning but increases at higher t.


FIG5ExactEuler

Figure 5: The dynamics of the single pendulum and the variation of energy over time with and without the small angle approximation. The parameters are: h = 0.01, D = 0.2, theta_initial = (pi x 3)/4.


extra

Figure 6: The dynamics of the single pendulum and the variation of energy over time with and without the small angle approximation. The parameters are: h = 0.3, D =0.2, theta_initial = (pi x 3)/4. The graph without the small angle approximation is stable, whereas the former is unstable.


  • Double Pendulum

FIG7DoubleMotionNoDamp

Figure 7: The dynamics of the double pendulum with parameters: h = 0.01, G = 0.0, R = {0.01, 1, 100}.


FIG9DoubleEnergyNoDamp

Figure 8: The variation of energy over time with parameters: h = 0.01, G = 0.0, R = {0.01, 1, 100} (i.e. the system in FIG. 7).


FIG8DoubleMotionDamp

Figure 9: The dynamics of the double pendulum with parameters: h = 0.01, G = 1.0, R = {0.01, 1, 100}.


FIG10DoubleEnergyDamp

Figure 10: The variation of $E$ over $t$ with parameters: h = 0.01, G = 1.0, R = {0.01, 1, 100}.

🔗 Links

linkedin

License

License: MIT

About

Modelling Single & Double Pendulum Systems (MSDPS) - Using finite difference methods for solving ordinary differential equations

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published