2# This script generates a animated plot movie using series of png plots.
3# Default plot is crack area against load factor. Plot setttings can be changed
4# by modifying the gnuplot script get_animated_plot.gnu
7# displacement_loadFactor_crackArea_energy.csv
13# 1. Change working directory to the place where csv file is located.
14# This csv file is generated after running plotting_data.sh
16# 2. Make sure animated_plot.sh and get_animated_plot.gnu are accessible
17# from the working directory. This can be done by either copying
18# those two files to the working directory or adding them to the same
19# PATH (in .bashrc or .bash_profile)
21# 3. Make sure package ffmpeg is installed and loaded by a package
22# manager, for example, spack.
24# 4. If needed, modify parameter 'fps' in animated_plot.sh to the desired
25# number of frames per second for the output movie
27# 5. Run animated_plot.sh
29# 6. Obtain animated movie, animated_plot.mp4, in the same directory.
30# Movie will be opened automatically if macOS is used.
33DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null && pwd )"
34gnuplot -e "load '$DIR/get_animated_plot.gnu'; quit"
36# Load ffmpeg, if already installed using spack
42# Generate animated plot
43ffmpeg -y -f image2 -r $fps -i 'png/animated_plot_%03d.png' animated_plot.mp4
45# Delete generated png plots
51if [ ${machine} = "Darwin" ]
53 # echo "This is a Mac computer"
54 open animated_plot.mp4
56 echo "Animated plot is ready to open"