#!/bin/bash cd "${0%/*}" || exit # Run from this directory . ${WM_PROJECT_DIR:?}/bin/tools/RunFunctions # Tutorial run functions #------------------------------------------------------------------------------ # settings # operand setups setups=" kOmegaSST kEpsilon " # operand setups for the wall-normal height of the first-cell centre yps=" 0.05 1 2 5 10 30 50 100 " #------------------------------------------------------------------------------ plot_Rex_vs_Cf() { setup="$1" yp="$2" Uref="$3" nu="$4" sampleFile="results/$setup/$yp/profiles.dat" image="plots/$setup/Rex_vs_Cf_$yp.png" gnuplot</dev/null || { echo "gnuplot not found - skipping graph creation" 1>&2 exit 1 } # Requires awk command -v awk >/dev/null || { echo "awk not found - skipping graph creation" 1>&2 exit 1 } # Check "results" directory [ -d "results" ] || { echo "No results directory found - skipping graph creation" 1>&2 exit 1 } #------------------------------------------------------------------------------ for setup in $setups do for yp in $yps do echo "" echo "# Plots for the setup and y+: $setup - $yp" echo "" resultsDir="results/$setup/$yp" [ -d "$resultsDir" ] || { echo "No $resultsDir directory found - skipping graph creation" 1>&2 continue } dirPlots="plots/$setup" [ -d "$dirPlots" ] || mkdir -p "$dirPlots" Uref=$(foamDictionary $resultsDir/0/U -entry internalField | sed 's/^.*(\s*\([^ ]*\).*/\1/g') nu=$(foamDictionary $resultsDir/constant/transportProperties -entry nu | sed 's|^.*\s\(.*\);|\1|g') plot_Rex_vs_Cf "$setup" "$yp" "$Uref" "$nu" done done #------------------------------------------------------------------------------