Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/jbuckmccready/staticpendulum
https://github.com/jbuckmccready/staticpendulum
Last synced: 26 days ago
JSON representation
- Host: GitHub
- URL: https://github.com/jbuckmccready/staticpendulum
- Owner: jbuckmccready
- License: mit
- Created: 2014-08-27T03:54:37.000Z (over 10 years ago)
- Default Branch: master
- Last Pushed: 2019-11-06T19:40:58.000Z (about 5 years ago)
- Last Synced: 2024-10-15T13:59:15.744Z (2 months ago)
- Language: C++
- Size: 3 MB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Abstract
A damped electrostatic pendulum is modeled using a system of differential equations and solved using numerical integration methods. A two dimensional map of initial conditions is integrated to construct a colored fractal image formed by the discrete points of convergence. Multiple programmatic solutions were implemented using Mathematica, Python and C++ to compare and improve computational performance. A decrease of two orders of magnitude in computation time was obtained by writing an adaptive step Runge Kutta integration method in C++. With significantly improved computation times high resolution images are constructed and stitched together to form videos that demonstrate how the system progressively changes with varying physical parameters: gravity, air drag, attractor strength, etc. The optimized code enables further statistical analysis, and may be easily modified for other systems of differential equations, initial condition maps, and integration methods.# Compiling
CMakeLists.txt included. External libraries used: lodepng (https://github.com/lvandeve/lodepng) and jsoncpp (https://github.com/open-source-parsers/jsoncpp). Source for those libraries is included directly in this repository for simplicity but could be better maintained using submodules.No external libraries are required outside of this repository, but C++11/14 features and libraries are used (greatest performance found using GCC 4.9 using -ffastmath, -O3, etc.). I have only tested on two machines: an AMD Phenom II 720BE with unlocked 4th core and overclocked to 3.3Ghz with Windows 7, and an Intel i7-3630QM Ubuntu laptop. I found GCC to be the fastest, next Clang, and finally MSVC. GCC is very effective at optimizing the tight loops with floating point operations, and I was unable to speed up the integration by writing inline sse intrinsic instructions. However MSVC is significantly slower and may be sped up by writing some sse intrinsic instructions.
# Usage
The program takes in a json map configuration file and png image file name. An example configuration file is provided (map.json).
Example use:
$staticpendulum.exe map.json mapImage.png# Additional Information
Check the Presentation.pdf for example map images and general overview of the project.