#!/bin/sh #------------------------------------------------------------------------------ # ========= | # \\ / F ield | OpenFOAM: The Open Source CFD Toolbox # \\ / O peration | # \\ / A nd | www.openfoam.com # \\/ M anipulation | #------------------------------------------------------------------------------ # Copyright (C) 2017-2021 OpenCFD Ltd. #------------------------------------------------------------------------------ # License # This file is part of OpenFOAM, distributed under GPL-3.0-or-later. # # Script # plot # # Description # Creates .png graph of OpenFOAM results vs analytical solution for the # Joule heating case # #------------------------------------------------------------------------------ cd "${0%/*}" || exit # Run from this directory #------------------------------------------------------------------------------ # settings # stop on first error set -e #------------------------------------------------------------------------------ plot_x_vs_T() { sampleFile="$1" image="x_vs_T.png" gnuplot</dev/null || { echo "FOAM FATAL ERROR: gnuplot not found - skipping graph creation" 1>&2 exit 1 } OFDATA='postProcessing/sample1/solid/20000/centreLine_T_jouleHeatingSource:V_jouleHeatingSource:sigma.xy' [ -f "$OFDATA" ] || { echo "FOAM FATAL ERROR: OpenFOAM results not available in $OFDATA" 1>&2 exit 1 } #------------------------------------------------------------------------------ echo "" echo "# Plot:" echo "" plot_x_vs_T "$OFDATA" echo "End" #------------------------------------------------------------------------------