Introduction
Introduction Statistics Contact Development Disclaimer Help
ttwo-grain-collision.sh - granular - granular dynamics simulation
git clone git://src.adamsgaard.dk/granular
Log
Files
Refs
README
LICENSE
---
ttwo-grain-collision.sh (1269B)
---
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=two-grain-collision
8
9 # remove any old files associated with this id
10 rm -f ${id}.grains.*.{tsv,png} ${id}.mp4
11
12 # create two grains, and simulate their interaction over time
13 (granulargrain -R -u 0.1; granulargrain -f -x 1.2) | granular -e 4.0 -I …
14
15 # plot grain positions over time, colored by force magnitude
16 for f in ${id}.grains.*.tsv; do
17 #granular2img -f '$50' -l 'number of contacts' -t png < "$f" > "…
18 #granular2img -f '$5' -l 'x velocity [m/s]' -t png < "$f" > "${f…
19 granular2img -f '$14' -l 'force_x [N]' -t png < "$f" > "${f%.tsv…
20 done
21
22 # combine grain plots into animation
23 ffmpeg -y -framerate 5 -i ${id}.grains.%05d.png \
24 -c:v libx264 -r 30 -pix_fmt yuv420p ${id}.mp4
25
26 # open animation
27 xdg-open ${id}.mp4
28
29 # calculate bulk energy for each output file
30 > "${id}.energy.tsv"
31 for f in ${id}.grains.*.tsv; do
32 granularenergy < "$f" >> "${id}.energy.tsv"
33 done
34
35 # plot energy over time
36 gnuplot -e "set term png;\
37 set xlabel 'time step';\
38 set ylabel 'Energy [J]';\
39 plot '-' u 0:1 w lp t 'Total energy'" \
40 < "${id}.energy.tsv" > "${id}.energy.png"
41
42 # open energy plot
43 xdg-open "${id}.energy.png"
You are viewing proxied material from mx1.adamsgaard.dk. The copyright of proxied material belongs to its original authors. Any comments or complaints in relation to proxied material should be directed to the original authors of the content concerned. Please see the disclaimer for more details.