Commit 55776069 authored by Kutalmis Bercin's avatar Kutalmis Bercin Committed by Andrew Heather
Browse files

ENH: generalise bump2D Allrun and plot scripts

STYLE: renamed periodicHill createPlots -> plot for consistency

TUT: use nutLowReWallFunction for bump2D

- required for the new nutWallFuncs hierarchy
parent d13df0e4
......@@ -44,7 +44,7 @@ boundaryField
bump
{
type fixedValue;
type nutLowReWallFunction;
value uniform 0;
}
......
......@@ -3,6 +3,6 @@ cd ${0%/*} || exit 1 # Run from this directory
. $WM_PROJECT_DIR/bin/tools/CleanFunctions # Tutorial clean functions
cleanCase
\rm -f *.png
\rm -f *.png
#------------------------------------------------------------------------------
#!/bin/sh
cd ${0%/*} || exit 1 # Run from this directory
. $WM_PROJECT_DIR/bin/tools/RunFunctions # Tutorial run functions
. $WM_PROJECT_DIR/bin/tools/CleanFunctions # Tutorial clean functions
runApplication blockMesh
runApplication $(getApplication)
# Turbulence closure models
models="
kOmegaSST
SpalartAllmaras
"
for model in $models
do
echo "Processing model: $model"
\cp constant/turbulenceProperties.template constant/turbulenceProperties
runApplication -s "$model" foamDictionary -entry RAS.RASModel \
-set "$model" constant/turbulenceProperties
runApplication $(getApplication)
timeDir=$(foamListTimes -latestTime)
# Create datasets for benchmark comparisons
echo "# ccx tau_xx tau_yy tau_zz cp" > profiles.dat
foamDictionary -entry boundaryField.bump.value -value $timeDir/Cx | \
sed -n '/(/,/)/p' | sed -e 's/[()]//g;/^\s*$/d' > Cx.$$
foamDictionary -entry boundaryField.bump.value -value $timeDir/wallShearStress | \
sed -n '/(/,/)/p' | sed -e 's/[()]//g;/^\s*$/d' > tau.$$
foamDictionary -entry boundaryField.bump.value -value $timeDir/Cp | \
sed -n '/(/,/)/p' | sed -e 's/[()]//g;/^\s*$/d' > cp.$$
\paste -d ' ' Cx.$$ tau.$$ cp.$$ >> profiles.dat
\rm -f Cx.$$ tau.$$ cp.$$
# Store model results
modelDir="$model"
\rm -rf "$modelDir"
\mkdir "$modelDir"
\mv log* profiles.dat "$timeDir" postProcessing "$modelDir"
cleanTimeDirectories
done
#------------------------------------------------------------------------------
......@@ -19,11 +19,8 @@ simulationType RAS;
RAS
{
// RASModel kOmegaSST;
RASModel SpalartAllmaras;
RASModel TURB_MODE;
turbulence on;
printCoeffs on;
}
......
#!/bin/sh
# Note: CFL3D data available from:
# https://turbmodels.larc.nasa.gov/bump_sa.html
# The CFL3D-SpalartAllmaras datasets of Cf and Cp:
# Cf = https://turbmodels.larc.nasa.gov/Bump/SA/cf_bump.dat
# Cp = https://turbmodels.larc.nasa.gov/Bump/SA/cp_bump.dat
cd ${0%/*} || exit 1 # Run from this directory
. $WM_PROJECT_DIR/bin/tools/RunFunctions # Tutorial run functions
#set -x
plotTau() {
graphNameTau="hill2D_tau.png"
echo "Creating wallshear stress graph to $graphNameTau"
gnuplot<<PLT_TAU
plotCf() {
declare -a resultSet=("${!1}")
declare -a modelSet=("${!2}")
graphNameCf="hill2D_cf.png"
echo "Creating skin friction coefficient graph to $graphNameCf"
gnuplot<<PLT_CF
set terminal pngcairo font "helvetica,20" size 1000, 1000
set xrange [0:1.5]
set yrange [0:0.008]
set grid
set key bottom right
set xlabel "x"
set ylabel "c_f"
set output "$graphNameTau"
set ylabel "C_f" rotate by 0
set output "$graphNameCf"
results="${resultSet[*]}"
models="${modelSet[*]}"
Uref = 69.44
set lmargin 10
......@@ -27,18 +34,25 @@ plotTau() {
set bmargin 3.2
# plot \
# "profiles.dat" u 1:(sqrt(\$2*\$2+\$3*\$3+\$4*\$4)/(0.5*Uref*Uref)) \
# t "simpleFoam" w l lw 2 lc rgb "black", \
# "cf_bump_cfl3d_sa.dat" every 10 u 1:2 \
# t "CFL3D" w p ps 3 pt 6 lw 2 lc rgb "red"
# "cf_bump_cfl3d_sa.dat" every 10 u 1:2 t "CFL3D" \
# w p ps 3 pt 6 lw 2 lc rgb "red", \
# for [i=1:words(results)] word(results, i) \
# u 1:(sqrt(\$2*\$2+\$3*\$3+\$4*\$4)/(0.5*Uref*Uref)) \
# t word(models, i) with lines
plot \
"profiles.dat" u 1:(sqrt(\$2*\$2+\$3*\$3+\$4*\$4)/(0.5*Uref*Uref)) \
t "simpleFoam" w l lw 2 lc rgb "black"
PLT_TAU
for [i=1:words(results)] word(results, i) \
u 1:(sqrt(\$2*\$2+\$3*\$3+\$4*\$4)/(0.5*Uref*Uref)) \
t word(models, i) with lines
PLT_CF
}
plotCp() {
declare -a resultSet=("${!1}")
declare -a modelSet=("${!2}")
graphNameCp="hill2D_cp.png"
echo "Creating pressure coefficient graph to $graphNameCp"
gnuplot<<PLT_CP
......@@ -48,9 +62,11 @@ plotCp() {
set grid
set key bottom right
set xlabel "x"
set ylabel "c_p"
set ylabel "C_p" rotate by 0
set output "$graphNameCp"
results="${resultSet[@]}"
models="${modelSet[@]}"
Uref = 69.44
set lmargin 10
......@@ -58,14 +74,15 @@ plotCp() {
set bmargin 3.2
# plot \
# "profiles.dat" u 1:5 \
# t "simpleFoam" w l lw 2 lc rgb "black", \
# "cp_bump_cfl3d_sa.dat" every 10 u 1:2 \
# t "CFL3D" w p ps 3 pt 6 lw 2 lc rgb "red"
# "cp_bump_cfl3d_sa.dat" every 10 u 1:2 t "CFL3D" \
# w p ps 3 pt 6 lw 2 lc rgb "red", \
# for [i=1:words(results)] word(results, i) \
# u (\$1):(\$5) t word(models, i) with lines
plot \
"profiles.dat" u 1:5 \
t "simpleFoam" w l lw 2 lc rgb "black"
for [i=1:words(results)] word(results, i) \
u (\$1):(\$5) t word(models, i) with lines
PLT_CP
}
......@@ -86,21 +103,19 @@ then
exit 1
}
timeDir=$(foamListTimes -latestTime)
echo "# ccx tau_xx tau_yy tau_zz cp" > profiles.dat
foamDictionary -entry boundaryField.bump.value -value $timeDir/Cx | \
sed -n '/(/,/)/p' | sed -e 's/[()]//g;/^\s*$/d' > Cx.$$
foamDictionary -entry boundaryField.bump.value -value $timeDir/wallShearStress | \
sed -n '/(/,/)/p' | sed -e 's/[()]//g;/^\s*$/d' > tau.$$
foamDictionary -entry boundaryField.bump.value -value $timeDir/Cp | \
sed -n '/(/,/)/p' | sed -e 's/[()]//g;/^\s*$/d' > cp.$$
paste -d ' ' Cx.$$ tau.$$ cp.$$ >> profiles.dat
# Turbulence closure models
models=('kOmegaSST' 'kEpsilon')
plotTau
plotCp
modelResults=()
n=0
for model in "${models[@]}"
do
modelResults[$n]="${model}/profiles.dat"
n=$(($n+1))
done
\rm -f Cx.$$ tau.$$ cp.$$ profiles.dat
plotCp modelResults[@] models[@]
plotCf modelResults[@] models[@]
fi
# ------------------------------------------------------------------------------
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment