Various minor changes to tutorial scripts. In particular, ensuring that they all change to the containing directory so that batches of tutorials can be run easily from the root of the installation.
105 lines
2.1 KiB
Bash
Executable File
105 lines
2.1 KiB
Bash
Executable File
#!/bin/sh
|
|
cd ${0%/*} || exit 1 # Run from this directory
|
|
|
|
# Stop on first error
|
|
set -e
|
|
|
|
createEpsT()
|
|
{
|
|
index=$1
|
|
OF=$2
|
|
EXPT=$3
|
|
|
|
gnuplot<<EOF
|
|
set terminal postscript eps color enhanced
|
|
set output "OF_vs_EXPT_T$i.eps"
|
|
set xlabel "Channel width, x / [m]"
|
|
set ylabel "Temperature / [K]"
|
|
set grid
|
|
set key left top
|
|
set size 0.6, 0.6
|
|
set xrange [0:0.08]
|
|
set yrange [285:310]
|
|
plot \
|
|
"$EXPT" u (\$1/1000):(\$2+273.15) title "Expt 0.$index" \
|
|
with points lt 1 pt 6, \
|
|
"$OF" title "OpenFOAM 0.$index" with lines linetype -1
|
|
EOF
|
|
}
|
|
|
|
|
|
createEpsU()
|
|
{
|
|
index=$1
|
|
OF=$2
|
|
EXPT=$3
|
|
|
|
gnuplot<<EOF
|
|
set terminal postscript eps color enhanced
|
|
set output "OF_vs_EXPT_U$i.eps"
|
|
set xlabel "Channel width, x / [m]"
|
|
set ylabel "Vertical velocity component, Uy / [m/s]"
|
|
set grid
|
|
set key left top
|
|
set size 0.6, 0.6
|
|
set xrange [0:0.08]
|
|
set yrange [-0.2:0.2]
|
|
plot \
|
|
"$EXPT" u (\$1/1000):(\$2) title "Expt 0.$index" \
|
|
with points lt 1 pt 6, \
|
|
"$OF" u 1:4 title "OpenFOAM 0.$index" with lines linetype -1
|
|
EOF
|
|
}
|
|
|
|
echo "createGraphs:"
|
|
|
|
# test if gnuplot exists on the system
|
|
if ! which gnuplot > /dev/null 2>&1
|
|
then
|
|
echo "FOAM FATAL ERROR: gnuplot not found - skipping graph creation" >&2
|
|
exit 1
|
|
fi
|
|
|
|
SETSDIR="../postProcessing/sample"
|
|
|
|
if [ ! -d $SETSDIR ]
|
|
then
|
|
echo "FOAM FATAL ERROR: result sets not available in directory $SETSDIR" >&2
|
|
exit 1
|
|
fi
|
|
|
|
# paths to data
|
|
LATESTTIME=`ls $SETSDIR`
|
|
OFDATAROOT=$SETSDIR/$LATESTTIME
|
|
|
|
EXPTDATAROOT=./exptData
|
|
|
|
# generate temperature profiles
|
|
TSets="1 3 4 5 6 7 9"
|
|
for i in $TSets
|
|
do
|
|
echo " processing temperature profile at y/yMax of 0.$i"
|
|
|
|
OF="$OFDATAROOT/y0.${i}.xy"
|
|
EXPT="$EXPTDATAROOT/mt_z0_${i}0_lo.dat"
|
|
|
|
createEpsT $i $OF $EXPT
|
|
done
|
|
|
|
|
|
# generate velocity profiles
|
|
USets="1 3 4 5 6 7 9"
|
|
for i in $USets
|
|
do
|
|
echo " processing velocity profile at y/yMax of 0.$i"
|
|
|
|
OF="$OFDATAROOT/y0.${i}.xy"
|
|
EXPT="$EXPTDATAROOT/mv_z0_${i}0_lo.dat"
|
|
|
|
createEpsU $i $OF $EXPT
|
|
done
|
|
|
|
echo "End"
|
|
|
|
#------------------------------------------------------------------------------
|