#!/bin/sh cd "${0%/*}" || exit # Run from this directory #------------------------------------------------------------------------------ # settings # operand setups setups=" DFSEM DFM FSM " #------------------------------------------------------------------------------ plot_R_patch() { setup="$1" endTime=$(foamDictionary results/"$setup"/system/controlDict -entry endTime -value) benchmarkFile="resources/dataset/chan395.reystress" sampleFile="results/$setup/postProcessing/sampleUPrime2Mean/$endTime/inletPatch_columnAverage(UPrime2Mean).xy" image="plots/$setup/R_patch.png" gnuplot< [m^2/s^2]" set offset .05, .05 set output "$image" set title "Reynolds stresses on patch" # Benchmark - DNS benchmark = "$benchmarkFile" # Samples - OpenFOAM samples="$sampleFile" plot \ samples u 1:2 t "" w l lw 2 lc rgb "#009E73", \ samples u 1:5 t "" w l lw 2 lc rgb "#F0E440", \ samples u 1:7 t "" w l lw 2 lc rgb "#0072B2", \ samples u 1:3 t "" w l lw 2 lc rgb "#D55E00", \ benchmark u 1:3 t "_{DNS}" w l lw 2 dt 2 lc rgb "#009E73", \ benchmark u 1:4 t "_{DNS}" w l lw 2 dt 2 lc rgb "#F0E440", \ benchmark u 1:5 t "_{DNS}" w l lw 2 dt 2 lc rgb "#0072B2", \ benchmark u 1:6 t "_{DNS}" w l lw 2 dt 2 lc rgb "#D55E00" PLT_R_PATCH } plot_TR_patch() { setup="$1" endTime=$(foamDictionary results/"$setup"/system/controlDict -entry endTime -value) benchmarkFile="resources/dataset/chan395.reystress" sampleFile="results/$setup/postProcessing/sampleTPrime2Mean/$endTime/inletPatch_columnAverage(TPrime2Mean).xy" image="plots/$setup/TR_patch.png" gnuplot< [-]" set offset .05, .05 set output "$image" set title "Scalar Reynolds stresses on patch" # Benchmark - DNS benchmark = "$benchmarkFile" # Samples - OpenFOAM samples="$sampleFile" plot \ samples u 1:2 t "_{input}" w l lw 2 lc rgb "#D55E00", \ benchmark u 1:3 t "_{output}" w l lw 2 dt 2 lc rgb "#009E73" PLT_TR_PATCH } plot_R_cell() { setup="$1" endTime=$(foamDictionary results/"$setup"/system/controlDict -entry endTime -value) benchmarkFile="resources/dataset/chan395.reystress" sampleFile="results/$setup/postProcessing/sampleUPrime2Mean/$endTime/inletCell_columnAverage(UPrime2Mean).xy" image="plots/$setup/R_cell.png" gnuplot< [m^2/s^2]" set offset .05, .05 set output "$image" set title "Reynolds stresses on cell" # Benchmark - DNS benchmark= "$benchmarkFile" # Samples - OpenFOAM samples="$sampleFile" plot \ samples u 1:2 t "" w l lw 2 lc rgb "#009E73", \ samples u 1:5 t "" w l lw 2 lc rgb "#F0E440", \ samples u 1:7 t "" w l lw 2 lc rgb "#0072B2", \ samples u 1:3 t "" w l lw 2 lc rgb "#D55E00", \ benchmark u 1:3 t "_{DNS}" w l lw 2 dt 2 lc rgb "#009E73", \ benchmark u 1:4 t "_{DNS}" w l lw 2 dt 2 lc rgb "#F0E440", \ benchmark u 1:5 t "_{DNS}" w l lw 2 dt 2 lc rgb "#0072B2", \ benchmark u 1:6 t "_{DNS}" w l lw 2 dt 2 lc rgb "#D55E00" PLT_R_CELL } plot_TR_cell() { setup="$1" endTime=$(foamDictionary results/"$setup"/system/controlDict -entry endTime -value) benchmarkFile="resources/dataset/chan395.reystress" sampleFile="results/$setup/postProcessing/sampleTPrime2Mean/$endTime/inletCell_columnAverage(TPrime2Mean).xy" image="plots/$setup/TR_cell.png" gnuplot< [-]" set offset .05, .05 set output "$image" set title "Reynolds stresses on cell" # Benchmark - DNS benchmark= "$benchmarkFile" # Samples - OpenFOAM samples="$sampleFile" plot \ samples u 1:2 t "_{input}" w l lw 2 lc rgb "#D55E00", \ benchmark u 1:3 t "_{output}" w l lw 2 dt 2 lc rgb "#009E73" PLT_TR_CELL } plot_UMean_patch() { setup="$1" endTime=$(foamDictionary results/"$setup"/system/controlDict -entry endTime -value) benchmarkFile="resources/dataset/chan395.means" sampleFile="results/$setup/postProcessing/sampleUMean/$endTime/inletPatch_columnAverage(UMean).xy" image="plots/$setup/UMean_patch.png" gnuplot</dev/null || { echo "gnuplot not found - skipping graph creation" 1>&2 exit 1 } # Check directory: "results" [ -d "results" ] || { echo "No results directory found - skipping graph creation" 1>&2 exit 1 } #------------------------------------------------------------------------------ for setup in $setups do echo "" echo "# Plots for the setup: $setup" echo "" [ -d "results/$setup" ] || { echo "No results/$setup directory found - skipping graph creation" 1>&2 continue } dirPlots="plots/$setup" [ -d "$dirPlots" ] || mkdir -p "$dirPlots" plot_R_patch "$setup" plot_R_cell "$setup" plot_UMean_patch "$setup" plot_TR_patch "$setup" plot_TR_cell "$setup" plot_TMean_patch "$setup" done #------------------------------------------------------------------------------