mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
TUT: steadyBoundaryLayer: ensure compatibility with gnuplot version > 5.4
- fix various scripts
This commit is contained in:
@ -28,9 +28,8 @@ plot_yPlus_vs_uPlus() {
|
||||
set key spacing 0.75
|
||||
set xlabel "y^+"
|
||||
set ylabel "u^+"
|
||||
set offset .05, .05
|
||||
set parametric
|
||||
set trange [0:1.5]
|
||||
set trange [0:30]
|
||||
set logscale x
|
||||
set format x "10^{%T}"
|
||||
set output "$image"
|
||||
|
||||
@ -5,6 +5,6 @@ cd "${0%/*}" || exit # Run from this directory
|
||||
|
||||
cleanCase0
|
||||
|
||||
rm -f validation/*.eps
|
||||
rm -f validation/*.png
|
||||
|
||||
#------------------------------------------------------------------------------
|
||||
|
||||
@ -2,6 +2,48 @@
|
||||
cd "${0%/*}" || exit # Run from this directory
|
||||
#------------------------------------------------------------------------------
|
||||
|
||||
plot()
|
||||
{
|
||||
gnuplot<<PLT
|
||||
set terminal pngcairo font "helvetica,20" size 1000, 1000
|
||||
set encoding utf8
|
||||
set termoption dash
|
||||
set style increment user
|
||||
set style line 1 lt 1 linecolor rgb "blue" linewidth 1.5
|
||||
set style line 11 lt 2 linecolor rgb "black" linewidth 1.5
|
||||
|
||||
# time = system("foamListTimes -case .. -latestTime")
|
||||
time=$(foamListTimes -case .. -latestTime)
|
||||
|
||||
# benchmark
|
||||
benchmark="exptData/T3A.dat"
|
||||
|
||||
# plot turbulent intensity profile
|
||||
samples="../postProcessing/kGraph/".time."/line_k.xy"
|
||||
set xlabel "x"
|
||||
set ylabel "u'"
|
||||
set output "x_vs_u.png"
|
||||
set title "T3A - Flat plate - Turbulent intensity"
|
||||
plot [:1.5][:0.05] \
|
||||
samples u (\$1-0.04):(1./5.4*sqrt(2./3.*\$2)) t "kOmegaSSTLM" w l ls 1, \
|
||||
benchmark u (\$1/1000):(\$3/100) t "Experiment" w p ls 11
|
||||
|
||||
|
||||
# plot skin-friction coefficient profile
|
||||
samples="../postProcessing/wallShearStressGraph/".time."/line_wallShearStress.xy"
|
||||
set xlabel "Re_x"
|
||||
set ylabel "c_f"
|
||||
set output "Rex_vs_cf.png"
|
||||
set title "T3A - Flat plate - C_f"
|
||||
plot [:6e+5][0:0.01] \
|
||||
samples u ((\$1-0.04)*5.4/1.5e-05):(-\$2/0.5/5.4**2) t "kOmegaSSTLM" w l, \
|
||||
benchmark u (\$1/1000*5.4/1.51e-05):2 t "Experiment" w p ls 11
|
||||
PLT
|
||||
}
|
||||
|
||||
|
||||
#------------------------------------------------------------------------------
|
||||
|
||||
# Require gnuplot
|
||||
command -v gnuplot >/dev/null || {
|
||||
echo "FOAM FATAL ERROR: gnuplot not found - skipping graph creation" 1>&2
|
||||
@ -11,32 +53,7 @@ command -v gnuplot >/dev/null || {
|
||||
|
||||
#------------------------------------------------------------------------------
|
||||
|
||||
gnuplot<<GNUPLOT
|
||||
set term post enhanced color solid linewidth 2.0 20
|
||||
set out "graphs.eps"
|
||||
set encoding utf8
|
||||
set termoption dash
|
||||
set style increment user
|
||||
set style line 1 lt 1 linecolor rgb "blue" linewidth 1.5
|
||||
set style line 11 lt 2 linecolor rgb "black" linewidth 1.5
|
||||
plot
|
||||
|
||||
time = system("foamListTimes -case .. -latestTime")
|
||||
|
||||
set xlabel "x"
|
||||
set ylabel "u'"
|
||||
set title "T3A - Flat Plate - turbulent intensity"
|
||||
plot [:1.5][:0.05] \
|
||||
"../postProcessing/kGraph/".time."/line_k.xy" \
|
||||
u (\$1-0.04):(1./5.4*sqrt(2./3.*\$2))title "kOmegaSSTLM" w l ls 1, \
|
||||
"exptData/T3A.dat" u (\$1/1000):(\$3/100) title "Exp T3A" w p ls 11
|
||||
|
||||
set xlabel "Re_x"
|
||||
set ylabel "c_f"
|
||||
set title "T3A - Flat Plate - C_f"
|
||||
plot [:6e+5][0:0.01] \
|
||||
"../postProcessing/wallShearStressGraph/".time."/line_wallShearStress.xy" \
|
||||
u ((\$1-0.04)*5.4/1.5e-05):(-\$2/0.5/5.4**2) title "kOmegaSSTLM" w l, \
|
||||
"exptData/T3A.dat" u (\$1/1000*5.4/1.51e-05):2 title "Exp" w p ls 11
|
||||
GNUPLOT
|
||||
|
||||
#------------------------------------------------------------------------------
|
||||
|
||||
@ -14,16 +14,12 @@ plot_U() {
|
||||
gnuplot<<EOF1
|
||||
set terminal pngcairo font "helvetica,20" size 1000, 1000
|
||||
set grid
|
||||
set key top left
|
||||
set key top right
|
||||
set xrange [-0.4:1.2]
|
||||
set yrange [0:3]
|
||||
set xlabel "U/U_0"
|
||||
set ylabel "y/h"
|
||||
set output "$image"
|
||||
set lmargin 7.5
|
||||
set rmargin 1.5
|
||||
set tmargin 0.1
|
||||
set bmargin 3.2
|
||||
set format x "%.1f"
|
||||
set format y "%.1f"
|
||||
|
||||
@ -31,12 +27,13 @@ plot_U() {
|
||||
samples="$sampleDir"
|
||||
Uref="$Uref"
|
||||
href="$href"
|
||||
fields="p_U_turbulenceProperties:devReff.xy"
|
||||
|
||||
plot \
|
||||
"$sampleDir/x_by_h_01_U.xy" u (\$2/Uref):(\$1/href) w l lw 2 lc rgb "red" t "x/h = 1", \
|
||||
"$sampleDir/x_by_h_04_U.xy" u (\$2/Uref):(\$1/href) w l lw 2 lc rgb "green" t "x/h = 4", \
|
||||
"$sampleDir/x_by_h_06_U.xy" u (\$2/Uref):(\$1/href) w l lw 2 lc rgb "blue" t "x/h = 6", \
|
||||
"$sampleDir/x_by_h_10_U.xy" u (\$2/Uref):(\$1/href) w l lw 2 lc rgb "black" t "x/h = 10"
|
||||
samples."/x_by_h_01_".fields u (\$3/Uref):(\$1/href) w l lw 2 lc rgb "red" t "x/h = 1", \
|
||||
samples."/x_by_h_04_".fields u (\$3/Uref):(\$1/href) w l lw 2 lc rgb "green" t "x/h = 4", \
|
||||
samples."/x_by_h_06_".fields u (\$3/Uref):(\$1/href) w l lw 2 lc rgb "blue" t "x/h = 6", \
|
||||
samples."/x_by_h_10_".fields u (\$3/Uref):(\$1/href) w l lw 2 lc rgb "black" t "x/h = 10"
|
||||
EOF1
|
||||
}
|
||||
|
||||
@ -66,10 +63,6 @@ plot_tau() {
|
||||
set xlabel "x/h"
|
||||
set ylabel "C_f"
|
||||
set output "$image"
|
||||
set lmargin 10
|
||||
set rmargin 1.5
|
||||
set tmargin 0.1
|
||||
set bmargin 3.2
|
||||
|
||||
# OpenFOAM
|
||||
Uref="$Uref"
|
||||
@ -107,7 +100,7 @@ sampleDir=postProcessing/sample/"$timeDir"
|
||||
|
||||
#------------------------------------------------------------------------------
|
||||
|
||||
Uref=$(awk '{print $2}' $sampleDir/Uref_U.xy)
|
||||
Uref=$(awk '{print $2}' $sampleDir/Uref_p_U_turbulenceProperties:devReff.xy)
|
||||
|
||||
echo ""
|
||||
echo "# Plots the U profiles"
|
||||
|
||||
10
tutorials/incompressible/simpleFoam/rotatingCylinders/Allclean
Executable file
10
tutorials/incompressible/simpleFoam/rotatingCylinders/Allclean
Executable file
@ -0,0 +1,10 @@
|
||||
#!/bin/sh
|
||||
cd "${0%/*}" || exit # Run from this directory
|
||||
. ${WM_PROJECT_DIR:?}/bin/tools/CleanFunctions # Tutorial clean functions
|
||||
#------------------------------------------------------------------------------
|
||||
|
||||
cleanCase
|
||||
|
||||
rm -f *.png
|
||||
|
||||
#------------------------------------------------------------------------------
|
||||
@ -26,17 +26,19 @@ gnuplot<<EOF
|
||||
C = 0.5*A*A*R1*R1 + 2.*A*B*log(R1) - 0.5*B*B/R1/R1
|
||||
analytical_p(r) = 0.5*A*A*r*r + 2.*A*B*log(r) - 0.5*B*B/r/r - C
|
||||
|
||||
samples="postProcessing/sample1/1000/centreLine_p_U_U:Transformed.xy"
|
||||
|
||||
set ylabel "Pressure, p"
|
||||
set output "p.png"
|
||||
set samples 20
|
||||
set key bottom right
|
||||
plot "postProcessing/sample1/1000/centreLine_p.xy" w lines lw 2 lc "black" t "OpenFOAM", \
|
||||
plot samples u 1:2 w lines lw 2 lc "black" t "OpenFOAM", \
|
||||
analytical_p(x) w p ps 2 pt 6 lw 2 lc rgb "red" t "analytical"
|
||||
|
||||
set ylabel "U_{/Symbol q}, rad/s"
|
||||
set output "Utheta.png"
|
||||
set samples 20
|
||||
set key top right
|
||||
plot "postProcessing/sample1/1000/centreLine_U_U:Transformed.xy" u 1:6 w lines lw 2 lc "black" t "OpenFOAM", \
|
||||
plot samples u 1:7 w lines lw 2 lc "black" t "OpenFOAM", \
|
||||
analytical_utheta(x) w p ps 2 pt 6 lw 2 lc rgb "red" t "analytical"
|
||||
EOF
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
#!/bin/sh
|
||||
#!/bin/bash
|
||||
cd "${0%/*}" || exit # Run from this directory
|
||||
. ${WM_PROJECT_DIR:?}/bin/tools/RunFunctions # Tutorial run functions
|
||||
#------------------------------------------------------------------------------
|
||||
|
||||
Reference in New Issue
Block a user