openfoam/tutorials/verificationAndValidation/multiphase/interIsoFoam/porousDamBreak/plot
Johan Roenby 5fa2bc030d TUT: discInConstantPorousFlow/porousDamBreak: new tutorials for interIsoFoam
TUT: create verificationAndValidation/multiphase
     directory and migrate StefanProblem into this
2021-12-13 17:09:10 +00:00

63 lines
1.7 KiB
Bash
Executable File

#!/bin/bash
cd "${0%/*}" || exit # Run from this directory
. ${WM_PROJECT_DIR:?}/bin/tools/RunFunctions # Tutorial run functions
#------------------------------------------------------------------------------
plot_results() {
image="plots/surface_compare.png"
gnuplot<<EOF
reset
set terminal pngcairo font "helvetica,20" size 60.0in,70.0in
set grid
set xrange [0:1]
set yrange [0:0.25]
set xlabel "x [m]"
set ylabel "y [m]"
set output "$image"
set style rect fc lt -1 fs solid 0.15 noborder
set object 1 rect from 0.29, graph 0 to 0.59, graph 1
array exp_data[10] = \
['4', '6', '8', '10', '12', '14', '16', '18', '20', '22']
array time[10] = \
['0.4', '0.6', '0.8', '1', '1.2', '1.4', '1.6', '1.8', '2', '2.2']
set multiplot \
layout 5,2 \
title "Free surface elevation y vs horizontal position x" \
font "helvetica,42"
do for[k=1:10] {
set title "t = ".time[k]." [s]"
plot \
"postProcessing/freeSurface/".time[k]."/alpha.water_freeSurface.raw" \
w points pt 7 ps 2 lc rgb "red" t "OpenFOAM", \
"experimentalData/data_".exp_data[k].".dat" \
w points pt 7 ps 3 lc rgb "black" t "Liu et al."
}
unset multiplot
EOF
}
#------------------------------------------------------------------------------
# Requires gnuplot
command -v gnuplot >/dev/null || {
echo "FOAM FATAL ERROR: gnuplot not found - skipping graph creation" 1>&2
exit 1
}
#------------------------------------------------------------------------------
dirPlots="plots"
[ -d "$dirPlots" ] || mkdir -p "$dirPlots"
plot_results
#------------------------------------------------------------------------------