diff --git a/tutorials/incompressible/pimpleFoam/LES/periodicHill/transient/createPlots b/tutorials/incompressible/pimpleFoam/LES/periodicHill/transient/plot similarity index 100% rename from tutorials/incompressible/pimpleFoam/LES/periodicHill/transient/createPlots rename to tutorials/incompressible/pimpleFoam/LES/periodicHill/transient/plot diff --git a/tutorials/incompressible/simpleFoam/bump2D/0/nut b/tutorials/incompressible/simpleFoam/bump2D/0/nut index b4932f4e39edd700c040f3295ebd7d636798ac88..d21f7dee1298efb8a6150d6c94f4e25232d4527d 100644 --- a/tutorials/incompressible/simpleFoam/bump2D/0/nut +++ b/tutorials/incompressible/simpleFoam/bump2D/0/nut @@ -44,7 +44,7 @@ boundaryField bump { - type fixedValue; + type nutLowReWallFunction; value uniform 0; } diff --git a/tutorials/incompressible/simpleFoam/bump2D/Allclean b/tutorials/incompressible/simpleFoam/bump2D/Allclean index d505d168078d2a606f3032bdfa46f99c4f82756a..9960709f404cbc6e55851f9cb615e72ecea868c0 100755 --- a/tutorials/incompressible/simpleFoam/bump2D/Allclean +++ b/tutorials/incompressible/simpleFoam/bump2D/Allclean @@ -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 #------------------------------------------------------------------------------ diff --git a/tutorials/incompressible/simpleFoam/bump2D/Allrun b/tutorials/incompressible/simpleFoam/bump2D/Allrun index 61f1172ce8e59f88914bcf8c980feb4a3e9eb9e7..7013a485b16f727b31c601169cded17c60a2b934 100755 --- a/tutorials/incompressible/simpleFoam/bump2D/Allrun +++ b/tutorials/incompressible/simpleFoam/bump2D/Allrun @@ -1,9 +1,46 @@ #!/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 #------------------------------------------------------------------------------ diff --git a/tutorials/incompressible/simpleFoam/bump2D/constant/turbulenceProperties b/tutorials/incompressible/simpleFoam/bump2D/constant/turbulenceProperties.template similarity index 92% rename from tutorials/incompressible/simpleFoam/bump2D/constant/turbulenceProperties rename to tutorials/incompressible/simpleFoam/bump2D/constant/turbulenceProperties.template index 1aba2bb1fdffae11a15d1d634a0873277063d03b..0ac8b36c26554fec641f9e21b76f3ef2b3589066 100644 --- a/tutorials/incompressible/simpleFoam/bump2D/constant/turbulenceProperties +++ b/tutorials/incompressible/simpleFoam/bump2D/constant/turbulenceProperties.template @@ -19,11 +19,8 @@ simulationType RAS; RAS { -// RASModel kOmegaSST; - RASModel SpalartAllmaras; - + RASModel TURB_MODE; turbulence on; - printCoeffs on; } diff --git a/tutorials/incompressible/simpleFoam/bump2D/createPlots b/tutorials/incompressible/simpleFoam/bump2D/createPlots deleted file mode 100755 index 31c08adc247c17f0d59ddcbccb5e324a15b5b21b..0000000000000000000000000000000000000000 --- a/tutorials/incompressible/simpleFoam/bump2D/createPlots +++ /dev/null @@ -1,106 +0,0 @@ -#!/bin/sh -# Note: CFL3D data available from: -# https://turbmodels.larc.nasa.gov/bump_sa.html - -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 - 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" - - Uref = 69.44 - - set lmargin 10 - set rmargin 1.5 - 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" - - 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 -} - -plotCp() { - graphNameCp="hill2D_cp.png" - echo "Creating pressure coefficient graph to $graphNameCp" - gnuplot<<PLT_CP - set terminal pngcairo font "helvetica,20" size 1000, 1000 - set xrange [0:1.5] - set yrange [0.4:-0.8] - set grid - set key bottom right - set xlabel "x" - set ylabel "c_p" - set output "$graphNameCp" - - Uref = 69.44 - - set lmargin 10 - set rmargin 1.5 - 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" - - plot \ - "profiles.dat" u 1:5 \ - t "simpleFoam" w l lw 2 lc rgb "black" -PLT_CP -} - - -if notTest $@ -then - # Create validation plots - - # Test if gnuplot exists on the system - command -v gnuplot >/dev/null 2>&1 || { - echo "gnuplot not found - skipping graph creation" 1>&2 - exit 1 - } - - # Test if awk exists on the system - command -v awk >/dev/null 2>&1 || { - echo "awk not found - skipping graph creation" 1>&2 - 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 - - plotTau - plotCp - - \rm -f Cx.$$ tau.$$ cp.$$ profiles.dat -fi - -# ------------------------------------------------------------------------------ diff --git a/tutorials/incompressible/simpleFoam/bump2D/plot b/tutorials/incompressible/simpleFoam/bump2D/plot new file mode 100755 index 0000000000000000000000000000000000000000..a30f46d332b3fc935771dffe11376e5c4ba1cb21 --- /dev/null +++ b/tutorials/incompressible/simpleFoam/bump2D/plot @@ -0,0 +1,121 @@ +#!/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 + + +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" rotate by 0 + set output "$graphNameCf" + + results="${resultSet[*]}" + models="${modelSet[*]}" + Uref = 69.44 + + set lmargin 10 + set rmargin 1.5 + set bmargin 3.2 + +# plot \ +# "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 \ + 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 + set terminal pngcairo font "helvetica,20" size 1000, 1000 + set xrange [0:1.5] + set yrange [0.4:-0.8] + set grid + set key bottom right + set xlabel "x" + set ylabel "C_p" rotate by 0 + set output "$graphNameCp" + + results="${resultSet[@]}" + models="${modelSet[@]}" + Uref = 69.44 + + set lmargin 10 + set rmargin 1.5 + set bmargin 3.2 + +# plot \ +# "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 \ + for [i=1:words(results)] word(results, i) \ + u (\$1):(\$5) t word(models, i) with lines + +PLT_CP +} + + +if notTest $@ +then + # Create validation plots + + # Test if gnuplot exists on the system + command -v gnuplot >/dev/null 2>&1 || { + echo "gnuplot not found - skipping graph creation" 1>&2 + exit 1 + } + + # Test if awk exists on the system + command -v awk >/dev/null 2>&1 || { + echo "awk not found - skipping graph creation" 1>&2 + exit 1 + } + + # Turbulence closure models + models=('kOmegaSST' 'kEpsilon') + + modelResults=() + n=0 + for model in "${models[@]}" + do + modelResults[$n]="${model}/profiles.dat" + n=$(($n+1)) + done + + plotCp modelResults[@] models[@] + plotCf modelResults[@] models[@] +fi + +# ------------------------------------------------------------------------------