#!/bin/bash

if ! which gnuplot > /dev/null 2>&1
then
    echo 'gnuplot not found - skipping graph creation' >&2
    exit 1
fi

gnuplot<<EOF
    set terminal pngcairo color enhanced font "Helvetica,20"
    set output 'void_fraction.png'

    set xlabel 'Radial coordinate r/R (-)'
    set ylabel 'Void fraction (-)'
    set key at graph 0.65,0.95

    set xrange [0:1]
    set yrange [0:0.15]

    file = system("ls ../postProcessing/graph/$(foamListTimes -case .. -latestTime)/*.csv")

    plot file u (\$1/0.01905):(\$2+\$3) w lp lt 1 t 'Simulation', \
    './exptData/alpha.gas' u 1:2 w p lt rgb "black" pt 4 t 'Experiment'

EOF

#------------------------------------------------------------------------------
