Skip to content

Physics simulator for loaded strings and mass-spring coupled oscillators.

License

Notifications You must be signed in to change notification settings

aa1gd/loaded-string-simulator

Repository files navigation

loaded-string-simulator

Loaded String

loaded-string-simulator is a physics simulator that can simulate loaded strings and mass-spring coupled oscillators. It uses the GNU Scientific Library (GSL) for computation and gnuplot to generate plots.

Compiling

This program was developed on Linux. It may work on MacOS, but probably will not work on Windows since commands are fed to gnuplot through a pipe.

Ensure GSL, libgsl-devel, and gnuplot are installed. If you want to generate gifs, install either ffmpeg or imagemagick and enable the appropriate option for GIFFLAGS in the makefile.

Then run

make

Change #define statements in plot.c to change the appearance of plots.

Usage

Setup simulation parameters, following the pattern in either examples/examplestringsetup.txt or examples/examplespringsetup.txt.

Then run

./simulate [OPTIONS] [FILE]

Options

-p, --print
prints eigenfrequencies, eigenvectors, and mode amplitudes in terminal (default option if no options specified)

-e, --eigenfrequencies
plots eigenfrequencies

-a, --amplitudes
plots mode amplitudes

-m, --modes
plots individual normal modes

-s, --simulate [TIME_SCALE]
animates the simulation at a speed TIME_SCALE x real speed. TIME_SCALE defaults to 1.0 if unspecified

-g, --gif
only use following -s option. Saves animation as a .gif

Examples

Band Gap

Band Gap

Mode Amplitudes

Mode Amplitudes

Individual Normal Modes

Individual Normal Modes

Wave Propagation

Wave Propagation

Coupled Springs

Coupled Springs

Licensing

This project is licensed under the GPLv3.

About

Physics simulator for loaded strings and mass-spring coupled oscillators.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published