Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
branch: master
Fetching contributors…

Cannot retrieve contributors at this time

executable file 127 lines (107 sloc) 3.35 kb
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127
#!/bin/sh
#------------------------------------------------------------------------------
# ========= |
# \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
# \\ / O peration |
# \\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
# \\/ M anipulation |
#-------------------------------------------------------------------------------
# License
# This file is part of OpenFOAM.
#
# OpenFOAM is free software: you can redistribute it and/or modify it
# under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
# for more details.
#
# You should have received a copy of the GNU General Public License
# along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
#
# Script
# createGraphs
#
# Description
# Creates .eps graphs of OpenFOAM results vs experiment for the buoyant
# cavity case
#
#------------------------------------------------------------------------------

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:3 title "OpenFOAM 0.$index" with lines linetype -1
EOF
}


# test if gnuplot exists on the system
type -P gnuplot &>/dev/null || {
    echo "gnuplot not found - skipping graph creation" >&2
    exit 1
}

SETSDIR="../postProcessing/sets"

if [ ! -d $SETSDIR ]
then
    echo "createGraphs: results sets not available in folder $SETSDIR"
    exit 0
fi

# paths to data
LATESTTIME=`ls $SETSDIR`
OFDATAROOT=../postProcessing/sets/$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}_T.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}_U.xy"
    EXPT="$EXPTDATAROOT/mv_z0_${i}0_lo.dat"

    createEpsU $i $OF $EXPT
done

echo Done

#------------------------------------------------------------------------------
Something went wrong with that request. Please try again.