#!/bin/bash

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

gnuplot<<EOF
    set grid

    #---PNG---
    set term pngcairo size 800,600
    FType = '.png'

    #---graph---
    set output 'alphaAir'.FType

    PATH = '../postProcessing/graph/1/'
    FILE = 'line.csv'

    set xlabel 'x'
    set xrange [0:0.1]

    set ylabel '{/Symbol a}_{airD}'
    set yrange [0:]

    plot PATH.FILE u (column('x')):(column('alpha.airD')) w l t "current" , \
              FILE u (column('x')):(column('alpha.airD')) w l t "reference"

    #---
    set output 'f2'.FType

    set ylabel 'f_2'
    set yrange [-0.05:1.05]

    plot PATH.FILE u (column('x')):(column('f2.airD')) w l t "current" , \
              FILE u (column('x')):(column('f2.airD')) w l t "reference"

    set autoscale xy


    #---number-density---
    set output 'numberDensity'.FType

    PATH ='../postProcessing/numberDensity/1/'
    FILE = 'numberDensity.xy'

    set xlabel 'd (mm)'
    set ylabel 'n(m^{-3}m^{-3})'
    set logscale y

    plot PATH.FILE u (\$1*1e3):2 w l t "current" , \
              FILE u (\$1*1e3):2 w l t "reference"

EOF

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