tmany-grain-collision.sh - granular - granular dynamics simulation | |
git clone git://src.adamsgaard.dk/granular | |
Log | |
Files | |
Refs | |
README | |
LICENSE | |
--- | |
tmany-grain-collision.sh (745B) | |
--- | |
1 #!/bin/sh | |
2 | |
3 # stop the shell script if there's an error | |
4 set -e | |
5 | |
6 # set a common id string for files | |
7 id=many-grain-collision | |
8 | |
9 # remove any old files associated with this id | |
10 rm -f ${id}.grains.*.{tsv,png} ${id}.mp4 | |
11 | |
12 # create a single grain and a granular packing, and simulate the interac… | |
13 (granulargrain -R -u 1.0 -y 2.5; granularpacking -X 2.2) | granular -e 4… | |
14 | |
15 # plot grain positions over time, colored by their horizontal velocity | |
16 for f in ${id}.grains.*.tsv; do | |
17 granular2img -f '$5' -l 'x velocity [m/s]' -t png < "$f" > "${f%… | |
18 done | |
19 | |
20 # combine grain plots into animation | |
21 ffmpeg -y -framerate 5 -i ${id}.grains.%05d.png \ | |
22 -c:v libx264 -r 30 -pix_fmt yuv420p ${id}.mp4 | |
23 | |
24 # open animation | |
25 xdg-open ${id}.mp4 |