664 lines
20 KiB
Bash
Executable File
664 lines
20 KiB
Bash
Executable File
#!/bin/bash
|
|
cd "${0%/*}" || exit # Run from this directory
|
|
. ${WM_PROJECT_DIR:?}/bin/tools/RunFunctions # Tutorial run functions
|
|
#------------------------------------------------------------------------------
|
|
|
|
# settings
|
|
|
|
# operand setups
|
|
setups="
|
|
0
|
|
10
|
|
20
|
|
30
|
|
40
|
|
50
|
|
60
|
|
70
|
|
80
|
|
85
|
|
"
|
|
|
|
|
|
#------------------------------------------------------------------------------
|
|
|
|
plot_initial_iteration_residuals() {
|
|
|
|
setup="$1"
|
|
|
|
echo " Plotting the initial-iteration residuals for $setup"
|
|
|
|
# benchmarkFile="..."
|
|
samples="results/$setup/logs"
|
|
image="plots/$setup/initial-iteration-residuals.png"
|
|
|
|
gnuplot<<PLT_RES
|
|
set terminal pngcairo font "helvetica,20" size 1000, 1000
|
|
set grid
|
|
set logscale y
|
|
set key right top
|
|
set key samplen 2
|
|
set key spacing 0.75
|
|
set xlabel "Iters"
|
|
set ylabel "Initial-iteration residuals"
|
|
set offset .2, .05
|
|
set output "$image"
|
|
set title "Max non-orthogonality degree: $setup"
|
|
|
|
file_exists(file) = system("[ -f '".file."' ] && echo '1' || echo '0'") + 0
|
|
|
|
Ux="$samples/Ux_0"
|
|
p="$samples/p_0"
|
|
k="$samples/k_0"
|
|
omega="$samples/omega_0"
|
|
nuTilda="$samples/nuTilda_0"
|
|
gammaInt="$samples/gammaInt_0"
|
|
ReThetat="$samples/ReThetat_0"
|
|
|
|
if ( file_exists(k) ) {
|
|
if ( ! file_exists(gammaInt) ) {
|
|
plot \
|
|
Ux u 1:2 t "Ux" w l lw 2 lc rgb "#009E73", \
|
|
p u 1:2 t "p" w l lw 2 lc rgb "#F0E440", \
|
|
k u 1:2 t "k" w l lw 2 lc rgb "#0072B2", \
|
|
omega u 1:2 t "omega" w l lw 2 lc rgb "#D55E00"
|
|
} else {
|
|
plot \
|
|
Ux u 1:2 t "Ux" w l lw 2 lc rgb "#009E73", \
|
|
p u 1:2 t "p" w l lw 2 lc rgb "#F0E440", \
|
|
k u 1:2 t "k" w l lw 2 lc rgb "#0072B2", \
|
|
omega u 1:2 t "omega" w l lw 2 lc rgb "#D55E00", \
|
|
gammaInt u 1:2 t "gammaInt" w l lw 2 lc rgb "#CC79A7", \
|
|
ReThetat u 1:2 t "ReThetat" w l lw 2 lc rgb "#440154"
|
|
}
|
|
} else {
|
|
plot \
|
|
Ux u 1:2 t "Ux" w l lw 2 lc rgb "#009E73", \
|
|
p u 1:2 t "p" w l lw 2 lc rgb "#F0E440", \
|
|
nuTilda u 1:2 t "nuTilda" w l lw 2 lc rgb "#0072B2"
|
|
}
|
|
PLT_RES
|
|
}
|
|
|
|
|
|
plot_final_iteration_residuals() {
|
|
|
|
setup="$1"
|
|
|
|
echo " Plotting the final-iteration residuals for $setup"
|
|
|
|
# benchmarkFile="..."
|
|
samples="results/$setup/logs"
|
|
image="plots/$setup/final-iteration-residuals.png"
|
|
|
|
gnuplot<<PLT_RES
|
|
set terminal pngcairo font "helvetica,20" size 1000, 1000
|
|
set grid
|
|
set logscale y
|
|
set key right top
|
|
set key samplen 2
|
|
set key spacing 0.75
|
|
set xlabel "Iters"
|
|
set ylabel "Final-iteration residuals"
|
|
set offset .2, .05
|
|
set output "$image"
|
|
set title "Max non-orthogonality degree: $setup"
|
|
|
|
file_exists(file) = system("[ -f '".file."' ] && echo '1' || echo '0'") + 0
|
|
|
|
Ux="$samples/UxFinalRes_0"
|
|
p="$samples/pFinalRes_0"
|
|
k="$samples/kFinalRes_0"
|
|
omega="$samples/omegaFinalRes_0"
|
|
nuTilda="$samples/nuTildaFinalRes_0"
|
|
gammaInt="$samples/gammaIntFinalRes_0"
|
|
ReThetat="$samples/ReThetatFinalRes_0"
|
|
|
|
if ( file_exists(k) ) {
|
|
if ( ! file_exists(gammaInt) ) {
|
|
plot \
|
|
Ux u 1:2 t "Ux" w l lw 2 lc rgb "#009E73", \
|
|
p u 1:2 t "p" w l lw 2 lc rgb "#F0E440", \
|
|
k u 1:2 t "k" w l lw 2 lc rgb "#0072B2", \
|
|
omega u 1:2 t "omega" w l lw 2 lc rgb "#D55E00"
|
|
} else {
|
|
plot \
|
|
Ux u 1:2 t "Ux" w l lw 2 lc rgb "#009E73", \
|
|
p u 1:2 t "p" w l lw 2 lc rgb "#F0E440", \
|
|
k u 1:2 t "k" w l lw 2 lc rgb "#0072B2", \
|
|
omega u 1:2 t "omega" w l lw 2 lc rgb "#D55E00", \
|
|
gammaInt u 1:2 t "gammaInt" w l lw 2 lc rgb "#CC79A7", \
|
|
ReThetat u 1:2 t "ReThetat" w l lw 2 lc rgb "#440154"
|
|
}
|
|
} else {
|
|
plot \
|
|
Ux u 1:2 t "Ux" w l lw 2 lc rgb "#009E73", \
|
|
p u 1:2 t "p" w l lw 2 lc rgb "#F0E440", \
|
|
nuTilda u 1:2 t "nuTilda" w l lw 2 lc rgb "#0072B2"
|
|
}
|
|
PLT_RES
|
|
}
|
|
|
|
|
|
plot_yPlus_vs_uPlus() {
|
|
|
|
setup="$1"
|
|
endTime="$2"
|
|
nu="$3"
|
|
uTau="$4"
|
|
|
|
# benchmarkFile="$FOAM_TUTORIALS/resources/dataset/planeChannelFlow/ReTau-395/chan395.means"
|
|
sampleFile="results/$setup/postProcessing/sample/$endTime/y_U.xy"
|
|
image="plots/$setup/yPlus_vs_uPlus.png"
|
|
|
|
gnuplot<<PLT_Y_VS_U
|
|
set terminal pngcairo font "helvetica,20" size 1000, 1000
|
|
set grid
|
|
set xrange [0:200]
|
|
set yrange [0:20]
|
|
set logscale x
|
|
set key left top reverse
|
|
set key samplen 2
|
|
set key spacing 0.75
|
|
set xlabel "y^+"
|
|
set ylabel "u^+"
|
|
set output "$image"
|
|
set title "Setup: $setup" noenhanced
|
|
|
|
# Benchmark - Experimental
|
|
# benchmark="$benchmarkFile"
|
|
|
|
# OpenFOAM - Numerical
|
|
samples="$sampleFile"
|
|
|
|
|
|
plot \
|
|
samples u (\$1*$uTau/$nu):(\$2/$uTau) t "OpenFOAM" w l lw 2 lc rgb "#4169e1"
|
|
# benchmark u 2:3 t "DNS" w p ps 2 pt 7 lc rgb "#ffc020"
|
|
PLT_Y_VS_U
|
|
}
|
|
|
|
|
|
plot_yPlus_vs_R() {
|
|
|
|
setup="$1"
|
|
endTime="$2"
|
|
nu="$3"
|
|
uTau="$4"
|
|
|
|
# benchmarkFile="$FOAM_TUTORIALS/resources/dataset/planeChannelFlow/ReTau-395/chan395.reystress"
|
|
sampleFile="results/$setup/postProcessing/sample/$endTime/y_turbulenceProperties:R.xy"
|
|
sampleFileK="results/$setup/postProcessing/sample/$endTime/y_turbulenceProperties:k.xy"
|
|
imageUU="plots/$setup/yPlus_vs_Ruu.png"
|
|
imageVV="plots/$setup/yPlus_vs_Rvv.png"
|
|
imageWW="plots/$setup/yPlus_vs_Rww.png"
|
|
imageUV="plots/$setup/yPlus_vs_Ruv.png"
|
|
imageK0="plots/$setup/yPlus_vs_kPlus0.png"
|
|
imageK1="plots/$setup/yPlus_vs_kPlus1.png"
|
|
|
|
gnuplot<<PLT_Y_VS_R
|
|
set terminal pngcairo font "helvetica,20" size 1000, 1000
|
|
set grid
|
|
#set xrange [0:200]
|
|
#set yrange [0:1]
|
|
set logscale x
|
|
set key left top reverse
|
|
set key samplen 2
|
|
set key spacing 0.75
|
|
set xlabel "y^+"
|
|
set ylabel "(uu)^+"
|
|
set output "$imageUU"
|
|
set title "Setup: $setup" noenhanced
|
|
|
|
# Benchmark - Experimental
|
|
# benchmark="$benchmarkFile"
|
|
|
|
# OpenFOAM - Numerical
|
|
samples="$sampleFile"
|
|
samplesK="$sampleFileK"
|
|
|
|
|
|
plot \
|
|
samples u (\$1*$uTau/$nu):(\$2/$uTau**2) t "OpenFOAM" w l lw 2 lc rgb "#4169e1"
|
|
# benchmark u 2:3 t "DNS" w p ps 2 pt 7 lc rgb "#ffc020"
|
|
|
|
set output "$imageVV"
|
|
set ylabel "(vv)^+"
|
|
plot \
|
|
samples u (\$1*$uTau/$nu):(\$5/$uTau**2) t "OpenFOAM" w l lw 2 lc rgb "#4169e1"
|
|
# benchmark u 2:4 t "DNS" w p ps 2 pt 7 lc rgb "#ffc020"
|
|
|
|
set output "$imageWW"
|
|
set ylabel "(ww)^+"
|
|
plot \
|
|
samples u (\$1*$uTau/$nu):(\$7/$uTau**2) t "OpenFOAM" w l lw 2 lc rgb "#4169e1"
|
|
# benchmark u 2:5 t "DNS" w p ps 2 pt 7 lc rgb "#ffc020"
|
|
|
|
set output "$imageUV"
|
|
set ylabel "(uv)^+"
|
|
plot \
|
|
samples u (\$1*$uTau/$nu):(-\$3/$uTau**2) t "OpenFOAM" w l lw 2 lc rgb "#4169e1"
|
|
# benchmark u 2:(\$6*-1) t "DNS" w p ps 2 pt 7 lc rgb "#ffc020"
|
|
|
|
set output "$imageK0"
|
|
set ylabel "k^+"
|
|
plot \
|
|
samples u (\$1*$uTau/$nu):(0.5*(\$2 + \$5 + \$7)/$uTau**2) t "OpenFOAM" w l lw 2 lc rgb "#4169e1"
|
|
# benchmark u 2:(0.5*(\$3 + \$4 + \$5)) t "DNS" w p ps 2 pt 7 lc rgb "#ffc020"
|
|
|
|
set output "$imageK1"
|
|
set ylabel "k^+"
|
|
plot \
|
|
samplesK u (\$1*$uTau/$nu):(\$2/$uTau**2) t "OpenFOAM" w l lw 2 lc rgb "#4169e1"
|
|
# benchmark u 2:(0.5*(\$3 + \$4 + \$5)) t "DNS" w p ps 2 pt 7 lc rgb "#ffc020"
|
|
PLT_Y_VS_R
|
|
}
|
|
|
|
|
|
plot_yPlus_vs_epsilonPlus() {
|
|
|
|
setup="$1"
|
|
endTime="$2"
|
|
nu="$3"
|
|
uTau="$4"
|
|
|
|
# benchmarkFile="$FOAM_TUTORIALS/resources/dataset/planeChannelFlow/ReTau-395/chan395.kbal"
|
|
sampleFile="results/$setup/postProcessing/sampleEpsilon/$endTime/y_turbulenceProperties:epsilon.xy"
|
|
image="plots/$setup/yPlus_vs_epsilonPlus.png"
|
|
|
|
gnuplot<<PLT_Y_VS_EPSILON
|
|
set terminal pngcairo font "helvetica,20" size 1000, 1000
|
|
set grid
|
|
#set xrange [0:200]
|
|
#set yrange [0:20]
|
|
set logscale x
|
|
set key left top reverse
|
|
set key samplen 2
|
|
set key spacing 0.75
|
|
set xlabel "y^+"
|
|
set ylabel "{/Symbol e}^+"
|
|
set output "$image"
|
|
set title "Setup: $setup" noenhanced
|
|
|
|
# Benchmark - Experimental
|
|
# benchmark="$benchmarkFile"
|
|
|
|
# OpenFOAM - Numerical
|
|
samples="$sampleFile"
|
|
|
|
plot \
|
|
samples u (\$1*$uTau/$nu):(\$2*$nu/$uTau**4) t "OpenFOAM" w l lw 2 lc rgb "#4169e1"
|
|
# benchmark u 2:(-\$3) t "DNS" w p ps 2 pt 7 lc rgb "#ffc020"
|
|
PLT_Y_VS_EPSILON
|
|
}
|
|
|
|
|
|
plot_yPlus_vs_productionRatePlus() {
|
|
|
|
setup="$1"
|
|
endTime="$2"
|
|
nu="$3"
|
|
uTau="$4"
|
|
|
|
# benchmarkFile="$FOAM_TUTORIALS/resources/dataset/planeChannelFlow/ReTau-395/chan395.kbal"
|
|
sampleFile="results/$setup/postProcessing/sampleG/$endTime/y_productionRate.xy"
|
|
image="plots/$setup/yPlus_vs_productionRatePlus.png"
|
|
|
|
gnuplot<<PLT_Y_VS_PRODUCTION_RATE
|
|
set terminal pngcairo font "helvetica,20" size 1000, 1000
|
|
set grid
|
|
#set xrange [0:200]
|
|
#set yrange [0:20]
|
|
set logscale x
|
|
set key left top reverse
|
|
set key samplen 2
|
|
set key spacing 0.75
|
|
set xlabel "y^+"
|
|
set ylabel "P^+"
|
|
set output "$image"
|
|
set title "Setup: $setup" noenhanced
|
|
|
|
# Benchmark - Experimental
|
|
# benchmark="$benchmarkFile"
|
|
|
|
# OpenFOAM - Numerical
|
|
samples="$sampleFile"
|
|
|
|
plot \
|
|
samples u (\$1*$uTau/$nu):(\$2*$nu/$uTau**4) t "OpenFOAM" w l lw 2 lc rgb "#4169e1"
|
|
# benchmark u 2:4 t "DNS" w p ps 2 pt 7 lc rgb "#ffc020"
|
|
PLT_Y_VS_PRODUCTION_RATE
|
|
}
|
|
|
|
|
|
plot_yPlus_vs_uPlus_all_setups() {
|
|
|
|
setups=$@
|
|
|
|
# benchmarkFile="$FOAM_TUTORIALS/resources/dataset/planeChannelFlow/ReTau-395/chan395.means"
|
|
|
|
n=0
|
|
for setup in $setups
|
|
do
|
|
# few manipulations
|
|
endTime=$(foamDictionary results/$setup/system/controlDict -entry endTime -value)
|
|
nu=$(foamDictionary results/$setup/constant/transportProperties -entry nu | sed 's|^.*\s\(.*\);|\1|g')
|
|
tau=$(foamDictionary results/$setup/$endTime/wallShearStress -entry boundaryField.bottom.value -value | sed -n '/(/,/)/p' | sed -e 's/[()]//g;/^\s*$/d' | cut -d' ' -f6)
|
|
uTau=$(awk -v tau="$tau" 'BEGIN { printf "%.16f", sqrt(-1*tau) }')
|
|
|
|
sampleFiles[$n]="results/$setup/postProcessing/sample/$endTime/y_U.xy"
|
|
nus[$n]="$nu"
|
|
uTaus[$n]="$uTau"
|
|
n=$(($n+1))
|
|
done
|
|
|
|
image="plots/all_setups_yPlus_vs_uPlus.png"
|
|
|
|
gnuplot<<PLT_Y_VS_U_ALL_SETUPS
|
|
set terminal pngcairo font "helvetica,20" size 1000, 1000
|
|
set grid
|
|
set xrange [0:200]
|
|
set yrange [0:20]
|
|
set logscale x
|
|
set key left top reverse
|
|
set key samplen 2
|
|
set key spacing 0.75
|
|
set xlabel "y^+"
|
|
set ylabel "u^+"
|
|
set output "$image"
|
|
set title "Ground-normal profile" noenhanced
|
|
|
|
# Benchmark - Experimental
|
|
# benchmark="$benchmarkFile"
|
|
|
|
# OpenFOAM - Numerical
|
|
models="${setups[*]}"
|
|
samples="${sampleFiles[*]}"
|
|
nus="${nus[*]}"
|
|
uTaus="${uTaus[*]}"
|
|
|
|
plot \
|
|
for [i=1:words(samples)] word(samples, i) \
|
|
u (\$1*word(uTaus, i)/word(nus, i)):(\$2/word(uTaus, i)) \
|
|
t word(models, i) w l lw 2
|
|
# benchmark u 2:3 t "DNS" w p ps 2 pt 7 lc rgb "#ffc020"
|
|
PLT_Y_VS_U_ALL_SETUPS
|
|
}
|
|
|
|
|
|
plot_yPlus_vs_R_all_setups() {
|
|
|
|
setups=$@
|
|
|
|
# benchmarkFile="$FOAM_TUTORIALS/resources/dataset/planeChannelFlow/ReTau-395/chan395.reystress"
|
|
|
|
n=0
|
|
for setup in $setups
|
|
do
|
|
# few manipulations
|
|
endTime=$(foamDictionary results/$setup/system/controlDict -entry endTime -value)
|
|
nu=$(foamDictionary results/$setup/constant/transportProperties -entry nu | sed 's|^.*\s\(.*\);|\1|g')
|
|
tau=$(foamDictionary results/$setup/$endTime/wallShearStress -entry boundaryField.bottom.value -value | sed -n '/(/,/)/p' | sed -e 's/[()]//g;/^\s*$/d' | cut -d' ' -f6)
|
|
uTau=$(awk -v tau="$tau" 'BEGIN { printf "%.16f", sqrt(-1*tau) }')
|
|
|
|
sampleFiles[$n]="results/$setup/postProcessing/sample/$endTime/y_turbulenceProperties:R.xy"
|
|
sampleFilesK[$n]="results/$setup/postProcessing/sample/$endTime/y_turbulenceProperties:k.xy"
|
|
nus[$n]="$nu"
|
|
uTaus[$n]="$uTau"
|
|
n=$(($n+1))
|
|
done
|
|
|
|
imageUU="plots/all_setups_yPlus_vs_Ruu.png"
|
|
imageVV="plots/all_setups_yPlus_vs_Rvv.png"
|
|
imageWW="plots/all_setups_yPlus_vs_Rww.png"
|
|
imageUV="plots/all_setups_yPlus_vs_Ruv.png"
|
|
imageK0="plots/all_setups_yPlus_vs_kPlus0.png"
|
|
imageK1="plots/all_setups_yPlus_vs_kPlus1.png"
|
|
|
|
gnuplot<<PLT_Y_VS_R
|
|
set terminal pngcairo font "helvetica,20" size 1000, 1000
|
|
set grid
|
|
#set xrange [0:200]
|
|
#set yrange [0:1]
|
|
set logscale x
|
|
set key left top reverse
|
|
set key samplen 2
|
|
set key spacing 0.75
|
|
set xlabel "y^+"
|
|
set ylabel "(uu)^+"
|
|
set output "$imageUU"
|
|
set title "Ground-normal profile" noenhanced
|
|
|
|
# Benchmark - Experimental
|
|
# benchmark="$benchmarkFile"
|
|
|
|
# OpenFOAM - Numerical
|
|
models="${setups[*]}"
|
|
samples="${sampleFiles[*]}"
|
|
samplesK="${sampleFilesK[*]}"
|
|
nus="${nus[*]}"
|
|
uTaus="${uTaus[*]}"
|
|
|
|
plot \
|
|
for [i=1:words(samples)] word(samples, i) \
|
|
u (\$1*word(uTaus, i)/word(nus, i)):(\$2/word(uTaus, i)**2) \
|
|
t word(models, i) w l lw 2
|
|
# benchmark u 2:3 t "DNS" w p ps 2 pt 7 lc rgb "#ffc020"
|
|
|
|
set output "$imageVV"
|
|
set ylabel "(vv)^+"
|
|
plot \
|
|
for [i=1:words(samples)] word(samples, i) \
|
|
u (\$1*word(uTaus, i)/word(nus, i)):(\$5/word(uTaus, i)**2) \
|
|
t word(models, i) w l lw 2
|
|
# benchmark u 2:4 t "DNS" w p ps 2 pt 7 lc rgb "#ffc020"
|
|
|
|
set output "$imageWW"
|
|
set ylabel "(ww)^+"
|
|
plot \
|
|
for [i=1:words(samples)] word(samples, i) \
|
|
u (\$1*word(uTaus, i)/word(nus, i)):(\$7/word(uTaus, i)**2) \
|
|
t word(models, i) w l lw 2
|
|
# benchmark u 2:5 t "DNS" w p ps 2 pt 7 lc rgb "#ffc020"
|
|
|
|
set output "$imageUV"
|
|
set ylabel "(uv)^+"
|
|
plot \
|
|
for [i=1:words(samples)] word(samples, i) \
|
|
u (\$1*word(uTaus, i)/word(nus, i)):(-\$3/word(uTaus, i)**2) \
|
|
t word(models, i) w l lw 2
|
|
# benchmark u 2:(\$6*-1) t "DNS" w p ps 2 pt 7 lc rgb "#ffc020"
|
|
|
|
set output "$imageK0"
|
|
set ylabel "k^+"
|
|
plot \
|
|
for [i=1:words(samples)] word(samples, i) \
|
|
u (\$1*word(uTaus, i)/word(nus, i)):(0.5*(\$2 + \$5 + \$7)/word(uTaus, i)**2) \
|
|
t word(models, i) w l lw 2
|
|
# benchmark u 2:(0.5*(\$3 + \$4 + \$5)) t "DNS" w p ps 2 pt 7 lc rgb "#ffc020"
|
|
|
|
set output "$imageK1"
|
|
set ylabel "k^+"
|
|
plot \
|
|
for [i=1:words(samplesK)] word(samplesK, i) \
|
|
u (\$1*word(uTaus, i)/word(nus, i)):(\$2/word(uTaus, i)**2) \
|
|
t word(models, i) w l lw 2
|
|
# benchmark u 2:(0.5*(\$3 + \$4 + \$5)) t "DNS" w p ps 2 pt 7 lc rgb "#ffc020"
|
|
PLT_Y_VS_R
|
|
}
|
|
|
|
|
|
plot_yPlus_vs_epsilonPlus_all_setups() {
|
|
|
|
setups=$@
|
|
|
|
# benchmarkFile="$FOAM_TUTORIALS/resources/dataset/planeChannelFlow/ReTau-395/chan395.kbal"
|
|
|
|
n=0
|
|
for setup in $setups
|
|
do
|
|
# few manipulations
|
|
endTime=$(foamDictionary results/$setup/system/controlDict -entry endTime -value)
|
|
nu=$(foamDictionary results/$setup/constant/transportProperties -entry nu | sed 's|^.*\s\(.*\);|\1|g')
|
|
tau=$(foamDictionary results/$setup/$endTime/wallShearStress -entry boundaryField.bottom.value -value | sed -n '/(/,/)/p' | sed -e 's/[()]//g;/^\s*$/d' | cut -d' ' -f6)
|
|
uTau=$(awk -v tau="$tau" 'BEGIN { printf "%.16f", sqrt(-1*tau) }')
|
|
|
|
sampleFiles[$n]="results/$setup/postProcessing/sampleEpsilon/$endTime/y_turbulenceProperties:epsilon.xy"
|
|
nus[$n]="$nu"
|
|
uTaus[$n]="$uTau"
|
|
n=$(($n+1))
|
|
done
|
|
|
|
image="plots/all_setups_yPlus_vs_epsilonPlus.png"
|
|
|
|
gnuplot<<PLT_Y_VS_EPSILON_ALL_SETUPS
|
|
set terminal pngcairo font "helvetica,20" size 1000, 1000
|
|
set grid
|
|
#set xrange [0:200]
|
|
#set yrange [0:20]
|
|
set logscale x
|
|
set key left top reverse
|
|
set key samplen 2
|
|
set key spacing 0.75
|
|
set xlabel "y^+"
|
|
set ylabel "{/Symbol e}^+"
|
|
set output "$image"
|
|
set title "Setup: $setup" noenhanced
|
|
|
|
# Benchmark - Experimental
|
|
# benchmark="$benchmarkFile"
|
|
|
|
# OpenFOAM - Numerical
|
|
models="${setups[*]}"
|
|
samples="${sampleFiles[*]}"
|
|
nus="${nus[*]}"
|
|
uTaus="${uTaus[*]}"
|
|
|
|
plot \
|
|
for [i=1:words(samples)] word(samples, i) \
|
|
u (\$1*word(uTaus, i)/word(nus, i)):(\$2*word(nus, i)/word(uTaus, i)**4) \
|
|
t word(models, i) w l lw 2
|
|
# benchmark u 2:(-\$3) t "DNS" w p ps 2 pt 7 lc rgb "#ffc020"
|
|
PLT_Y_VS_EPSILON_ALL_SETUPS
|
|
}
|
|
|
|
|
|
plot_yPlus_vs_productionRatePlus_all_setups() {
|
|
|
|
setups=$@
|
|
|
|
# benchmarkFile="$FOAM_TUTORIALS/resources/dataset/planeChannelFlow/ReTau-395/chan395.kbal"
|
|
|
|
n=0
|
|
for setup in $setups
|
|
do
|
|
# few manipulations
|
|
endTime=$(foamDictionary results/$setup/system/controlDict -entry endTime -value)
|
|
nu=$(foamDictionary results/$setup/constant/transportProperties -entry nu | sed 's|^.*\s\(.*\);|\1|g')
|
|
tau=$(foamDictionary results/$setup/$endTime/wallShearStress -entry boundaryField.bottom.value -value | sed -n '/(/,/)/p' | sed -e 's/[()]//g;/^\s*$/d' | cut -d' ' -f6)
|
|
uTau=$(awk -v tau="$tau" 'BEGIN { printf "%.16f", sqrt(-1*tau) }')
|
|
|
|
sampleFiles[$n]="results/$setup/postProcessing/sampleG/$endTime/y_productionRate.xy"
|
|
nus[$n]="$nu"
|
|
uTaus[$n]="$uTau"
|
|
n=$(($n+1))
|
|
done
|
|
|
|
image="plots/all_setups_yPlus_vs_productionRatePlus.png"
|
|
|
|
gnuplot<<PLT_Y_VS_PRODUCTION_RATE_ALL_SETUPS
|
|
set terminal pngcairo font "helvetica,20" size 1000, 1000
|
|
set grid
|
|
#set xrange [0:200]
|
|
#set yrange [0:20]
|
|
set logscale x
|
|
set key left top reverse
|
|
set key samplen 2
|
|
set key spacing 0.75
|
|
set xlabel "y^+"
|
|
set ylabel "P^+"
|
|
set output "$image"
|
|
set title "Ground-normal profile" noenhanced
|
|
|
|
# Benchmark - Experimental
|
|
# benchmark="$benchmarkFile"
|
|
|
|
# OpenFOAM - Numerical
|
|
models="${setups[*]}"
|
|
samples="${sampleFiles[*]}"
|
|
nus="${nus[*]}"
|
|
uTaus="${uTaus[*]}"
|
|
|
|
plot \
|
|
for [i=1:words(samples)] word(samples, i) \
|
|
u (\$1*word(uTaus, i)/word(nus, i)):(\$2*word(nus, i)/word(uTaus, i)**4) \
|
|
t word(models, i) w l lw 2
|
|
# benchmark u 2:4 t "DNS" w p ps 2 pt 7 lc rgb "#ffc020"
|
|
PLT_Y_VS_PRODUCTION_RATE_ALL_SETUPS
|
|
}
|
|
|
|
|
|
#------------------------------------------------------------------------------
|
|
|
|
# Requires gnuplot
|
|
command -v 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
|
|
|
|
echo ""
|
|
echo "# Plots for the setup: $setup"
|
|
echo ""
|
|
|
|
dirPlots="plots/$setup"
|
|
[ -d "$dirPlots" ] || mkdir -p "$dirPlots"
|
|
|
|
# few manipulations
|
|
endTime=$(foamDictionary results/$setup/system/controlDict -entry endTime -value)
|
|
nu=$(foamDictionary results/$setup/constant/transportProperties -entry nu | sed 's|^.*\s\(.*\);|\1|g')
|
|
tau=$(foamDictionary results/$setup/$endTime/wallShearStress -entry boundaryField.bottom.value -value | sed -n '/(/,/)/p' | sed -e 's/[()]//g;/^\s*$/d' | cut -d' ' -f6)
|
|
uTau=$(awk -v tau="$tau" 'BEGIN { printf "%.16f", sqrt(-1*tau) }')
|
|
|
|
plot_yPlus_vs_uPlus "$setup" "$endTime" "$nu" "$uTau"
|
|
|
|
plot_yPlus_vs_R "$setup" "$endTime" "$nu" "$uTau"
|
|
|
|
plot_yPlus_vs_epsilonPlus "$setup" "$endTime" "$nu" "$uTau"
|
|
|
|
plot_yPlus_vs_productionRatePlus "$setup" "$endTime" "$nu" "$uTau"
|
|
|
|
plot_initial_iteration_residuals "$setup"
|
|
|
|
plot_final_iteration_residuals "$setup"
|
|
|
|
done
|
|
|
|
plot_yPlus_vs_uPlus_all_setups $setups
|
|
|
|
plot_yPlus_vs_R_all_setups $setups
|
|
|
|
plot_yPlus_vs_epsilonPlus_all_setups $setups
|
|
|
|
plot_yPlus_vs_productionRatePlus_all_setups $setups
|
|
|
|
|
|
#------------------------------------------------------------------------------
|