Skip to content

Files

Latest commit

274d56e · Dec 17, 2023

History

History
78 lines (52 loc) · 1.85 KB

README.md

File metadata and controls

78 lines (52 loc) · 1.85 KB

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.