#!/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 size 800,600
    set output 'alpha.png'

    set key outside below width -4
    set grid
    set xlabel 't'
    set ylabel '{/Symbol a}_{particle}, {/Symbol a}_{aggregate}'
    set y2label '{/Symbol a}_{water}'
    set y2tics
    set y2range [0.48:0.52]

    PATH  = '../postProcessing/probes/0/'
    RPATH = 'probes/0/'

    plot x > 4.25 ? 0.2333 : 0.25 - 0.004*x  w l lw 7 dt 3 \
             t 'particle - analytical', \
         x > 4.25 ? 0.2667 : 0.25 + 0.004*x  w l lw 7 dt 3 \
             t 'aggregate - analytical', \
         0.5                 axis x1y2 w l lw 7 dt 3 t 'water - analytical'   ,\
          PATH.'alpha.particle'        w l lw 3      t 'particle'             ,\
          PATH.'alpha.aggregate'       w l lw 3      t 'aggregate'            ,\
          PATH.'alpha.water' axis x1y2 w l lw 3      t 'water'                ,\
         RPATH.'alpha.particle'        w l      dt 2 t 'particle - reference' ,\
         RPATH.'alpha.aggregate'       w l      dt 2 t 'aggregate - reference',\
         RPATH.'alpha.water' axis x1y2 w l      dt 2 t 'water - reference'
EOF

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