#!/bin/bash cd "${0%/*}" || exit # Run from this directory . ${WM_PROJECT_DIR:?}/bin/tools/RunFunctions # Tutorial run functions #------------------------------------------------------------------------------ plot_U() { sampleDir="$1" Uref="$2" href="0.0127" image="backwardStep2D_U.png" gnuplot< tauw.dat foamDictionary -entry boundaryField.lowerWall.value -value "$timeDir"/Cx | \ sed -n '/(/,/)/p' | sed -e 's/[()]//g;/^\s*$/d' > Cx.$$ foamDictionary -entry boundaryField.lowerWall.value -value "$timeDir"/wallShearStress | \ sed -n '/(/,/)/p' | sed -e 's/[()]//g;/^\s*$/d' > tau.$$ paste -d ' ' Cx.$$ tau.$$ >> tauw.dat rm -f Cx.$$ tau.$$ image="backwardStep2D_tau.png" gnuplot</dev/null || { echo "FOAM FATAL ERROR: gnuplot not found - skipping graph creation" 1>&2 exit 1 } # Requires awk command -v awk >/dev/null || { echo "FOAM FATAL ERROR: awk not found - skipping graph creation" 1>&2 exit 1 } # Check "results" directory timeDir=$(foamListTimes -latestTime) sampleDir=postProcessing/sample/"$timeDir" [ -d "$sampleDir" ] || { echo "FOAM FATAL ERROR: sample/"$timeDir" directory not found - skipping graph creation" 1>&2 exit 1 } #------------------------------------------------------------------------------ Uref=$(awk '{print $2}' $sampleDir/Uref_U.xy) echo "" echo "# Plots the U profiles" echo "" plot_U "$sampleDir" "$Uref" echo "" echo "# Plots the wall-shear stress profiles" echo "" plot_tau "$timeDir" "$Uref" #------------------------------------------------------------------------------