TUT: oneCellThickPlaneChannel/planeChannel: update the tutorial

This commit is contained in:
Kutalmis Bercin
2021-12-17 09:37:10 +00:00
committed by Andrew Heather
parent 745fc42dee
commit ec96010ffb
86 changed files with 2636 additions and 1711 deletions

View File

@ -3,11 +3,7 @@ cd "${0%/*}" || exit # Run from this directory
. ${WM_PROJECT_DIR:?}/bin/tools/CleanFunctions # Tutorial clean functions
#------------------------------------------------------------------------------
cleanCase0
rm -rf 0.orig
rm -rf constant
rm -rf system
rm -rf setups
rm -rf results
rm -rf plots

View File

@ -1,7 +1,6 @@
#!/bin/sh
cd "${0%/*}" || exit # Run from this directory
. ${WM_PROJECT_DIR:?}/bin/tools/RunFunctions # Tutorial run functions
. ${WM_PROJECT_DIR:?}/bin/tools/CleanFunctions # Tutorial clean functions
#------------------------------------------------------------------------------
# settings
@ -9,57 +8,135 @@ cd "${0%/*}" || exit # Run from this directory
# operand setups
setups="
DFSEM
DFM
FSM
"
# flag to enable computations
run=true
# flag to enable computations in parallel mode
parallel=true
# flag to enable to use a common mesh
common_mesh=true
# flag to enable to use a common dynamic code
common_dynamic_code=true
#------------------------------------------------------------------------------
#######################################
# Collect results into a given path
# and clean the case for the next run
# Create the given setup
# Arguments:
# $1 = Path to move results
# $1 = Path to create the setup
# Outputs:
# Writes info to stdout
#######################################
collect() {
dry_run_setup() {
[ $# -eq 0 ] && { echo "Usage: $0 dir-model"; exit 1; }
[ $# -eq 0 ] && { echo "Usage error: $0"; exit 1; }
collection="$1"
setup="$1"
dirSetup="setups/$setup"
dirSetupOrig="setups.orig/$setup"
dirOrig="$dirSetupOrig/0.orig"
dirConstant="$dirSetupOrig/constant"
dirSystem="$dirSetupOrig/system"
dirResult=results/"$collection"
dirSettings="$dirResult"/settings
printf "\n# Create the setup: %s\n" "$setup"
if [ ! -d "$dirSetup" ]
then
mkdir -p "$dirSetup"
cp -aRfL "setups.orig/common/." "$dirSetup"
cp -afL "$dirSetupOrig"/All* "$dirSetup" 2>/dev/null || :
[ -d "$dirOrig" ] && cp -aRfL "$dirOrig/." "$dirSetup/0.orig"
[ -d "$dirConstant" ] && cp -aRfL "$dirConstant/." "$dirSetup/constant"
[ -d "$dirSystem" ] && cp -aRfL "$dirSystem/." "$dirSetup/system"
else
printf "\n # Directory %s already exists\n" "$dirSetup"
printf " # Skipping the creation of a new setup\n"
fi
}
#######################################
# Run the given setup
# Arguments:
# $1 = Path to the setup to run
# Outputs:
# Writes info to stdout
#######################################
run_setup() {
[ $# -eq 0 ] && { echo "Usage error: $0"; exit 1; }
setup="$1"
dirSetup="setups/$setup"
dirResult="results/$setup"
dry_run_setup "$setup"
[ -d results ] || mkdir -p results
printf "\n# Run the setup: %s\n\n" "$setup"
if [ ! -d "$dirResult" ]
then
cp -Rf "$dirSetup" "$dirResult"
echo " # Collecting results and settings into $dirResult"
if [ "$common_mesh" = true ]
then
if [ -d results/mesh ]
then
printf "## Copy the common mesh to the setup: %s\n\n" "$setup"
cp -Rf results/mesh/polyMesh "$dirResult"/constant/.
fi
fi
mkdir -p "$dirResult"
mkdir -p "$dirSettings"
if [ "$common_dynamic_code" = true ]
then
if [ -d results/dynamicCode ]
then
printf "## Copy the common dynamic code to the setup: %s\n\n" "$setup"
cp -Rf results/dynamicCode "$dirResult"/.
fi
fi
mv -f $(foamListTimes) "$dirResult"
[ -d postProcessing ] && mv -f postProcessing "$dirResult"
[ -d processor0 ] && mv -f processor* "$dirResult"
mv -f log.* "$dirResult"
cp -f system/{fv*,controlDict} constant/*Properties "$dirSettings"
mv -f 0/ "$dirSettings"
echo " # Cleaning up the case"
if [ "$parallel" = true ]
then
( cd "$dirResult" && ./Allrun-parallel )
else
( cd "$dirResult" && ./Allrun )
fi
if [ "$common_mesh" = true ]
then
if [ ! -d results/mesh ]
then
printf "\n## Store the mesh of %s as the common mesh\n\n" "$setup"
mkdir -p results/mesh
cp -Rf "$dirResult"/constant/polyMesh results/mesh/.
fi
fi
if [ "$common_dynamic_code" = true ]
then
if [ ! -d results/dynamicCode ] && [ -d "$dirResult"/dynamicCode ]
then
printf "\n## Store the dynamic code of %s as the common dynamic code\n\n" "$setup"
cp -Rf "$dirResult"/dynamicCode results/.
fi
fi
cleanTimeDirectories
cleanAuxiliary
cleanPostProcessing
else
echo " # Directory $dirResult already exists"
echo " # Skipping the computation"
printf " # Directory %s already exists\n" "$dirResult"
printf " # Skipping the computation of the given setup\n"
fi
}
@ -68,55 +145,28 @@ collect() {
for setup in $setups
do
dirSetupOrig="setups.orig/$setup"
echo ""
echo "# Computations for the setup: $setup"
echo ""
dirSetup="setups.orig/$setup"
cp -rfL "$dirSetup/0.orig" .
cp -rfL "$dirSetup/constant" .
cp -rfL "$dirSetup/system" .
cp -rf 0.orig/ 0/
if [ ! -d constant/polyMesh ]
if [ ! -d "$dirSetupOrig" ]
then
runApplication blockMesh
runApplication renumberMesh -overwrite -constant
runApplication checkMesh -allTopology -allGeometry -constant
echo "Setup directory: $dirSetupOrig" \
"could not be found - skipping execution" 1>&2
continue
fi
if [ "$parallel" = true ]
if [ "$run" = true ]
then
runApplication decomposePar
runParallel $(getApplication)
runApplication reconstructPar
run_setup "$setup"
else
runApplication $(getApplication)
dry_run_setup "$setup"
fi
runApplication -s columnAverage \
postProcess -func columnAverage -latestTime
runApplication -s sample \
postProcess -func sample -latestTime
runApplication -s skinFriction \
postProcess -func sampleCf -latestTime
collect "$setup"
done
if notTest "$@" && [ "$run" = true ]
then
./plot
fi
#------------------------------------------------------------------------------

View File

@ -7,6 +7,8 @@ cd "${0%/*}" || exit # Run from this directory
# operand setups
setups="
DFSEM
DFM
FSM
"
@ -17,14 +19,14 @@ plot_R_vs_y() {
setup="$1"
endTime="$2"
# benchmarkFile="ReTau-395/dataset/chan395.reystress"
benchmarkFile="$FOAM_TUTORIALS/verificationAndValidation/turbulentInflow/oneCellThickPlaneChannel/resources/dataset/chan395.reystress"
n=0
m=0
for l in {1..11}
do
m=$(($m+5))
sampleFiles[$n]="results/$setup/postProcessing/sample/$endTime/l${m}_columnAverage:columnAverage(UPrime2Mean).xy"
sampleFiles[$n]="results/$setup/postProcessing/sampleUPrime2Mean/$endTime/l${m}_columnAverage(UPrime2Mean).xy"
n=$(($n+1))
done
@ -43,18 +45,18 @@ plot_R_vs_y() {
set output "$image"
set multiplot layout 1,11 title "Setup: $setup" noenhanced
# Benchmark - Experimental
# benchmark ="$benchmarkFile"
# Benchmark
benchmark ="$benchmarkFile"
# OpenFOAM - Numerical
# OpenFOAM
samples="${sampleFiles[*]}"
list="5h 10h 15h 20h 25h 30h 35h 40h 45h 50h 55h"
do for [i = 1:11] {
if (i != 1) { unset ylabel }
plot \
word(samples, i) u 2:1 t word(list, i) w l lw 2 lc rgb "#4169e1"
# benchmark every 4 u 3:1 t "DNS" w p ps 2 pt 7 lc rgb "#D55E00"
word(samples, i) u 2:1 t word(list, i) w l lw 2 lc rgb "#4169e1", \
benchmark every 4 u 3:1 t "DNS" w p ps 2 pt 7 lc rgb "#D55E00"
}
unset multiplot
@ -76,18 +78,18 @@ PLT_RUU_VS_Y
set output "$image"
set multiplot layout 1,11 title "Setup: $setup" noenhanced
# Benchmark - Experimental
# benchmark="$benchmarkFile"
# Benchmark
benchmark="$benchmarkFile"
# OpenFOAM - Numerical
# OpenFOAM
samples="${sampleFiles[*]}"
list="5h 10h 15h 20h 25h 30h 35h 40h 45h 50h 55h"
do for [i = 1:11] {
if (i != 1) { unset ylabel }
plot \
word(samples, i) u 5:1 t word(list, i) w l lw 2 lc rgb "#4169e1"
# benchmark every 4 u 4:1 t "DNS" w p ps 2 pt 7 lc rgb "#D55E00"
word(samples, i) u 5:1 t word(list, i) w l lw 2 lc rgb "#4169e1", \
benchmark every 4 u 4:1 t "DNS" w p ps 2 pt 7 lc rgb "#D55E00"
}
unset multiplot
@ -110,18 +112,18 @@ PLT_RVV_VS_Y
set output "$image"
set multiplot layout 1,11 title "Setup: $setup" noenhanced
# Benchmark - Experimental
# benchmark="$benchmarkFile"
# Benchmark
benchmark="$benchmarkFile"
# OpenFOAM - Numerical
# OpenFOAM
samples="${sampleFiles[*]}"
list="5h 10h 15h 20h 25h 30h 35h 40h 45h 50h 55h"
do for [i = 1:11] {
if (i != 1) { unset ylabel }
plot \
word(samples, i) u 7:1 t word(list, i) w l lw 2 lc rgb "#4169e1"
# benchmark every 4 u 5:1 t "DNS" w p ps 2 pt 7 lc rgb "#D55E00"
word(samples, i) u 7:1 t word(list, i) w l lw 2 lc rgb "#4169e1", \
benchmark every 4 u 5:1 t "DNS" w p ps 2 pt 7 lc rgb "#D55E00"
}
unset multiplot
@ -143,18 +145,18 @@ PLT_RWW_VS_Y
set output "$image"
set multiplot layout 1,11 title "Setup: $setup" noenhanced
# Benchmark - Experimental
# benchmark="$benchmarkFile"
# Benchmark
benchmark="$benchmarkFile"
# OpenFOAM - Numerical
# OpenFOAM
samples="${sampleFiles[*]}"
list="5h 10h 15h 20h 25h 30h 35h 40h 45h 50h 55h"
do for [i = 1:11] {
if (i != 1) { unset ylabel }
plot \
word(samples, i) u (-\$3):1 t word(list, i) w l lw 2 lc rgb "#4169e1"
# benchmark every 4 u (-\$6):1 t "DNS" w p ps 2 pt 7 lc rgb "#D55E00"
word(samples, i) u (-\$3):1 t word(list, i) w l lw 2 lc rgb "#4169e1", \
benchmark every 4 u (-\$6):1 t "DNS" w p ps 2 pt 7 lc rgb "#D55E00"
}
unset multiplot
@ -168,14 +170,14 @@ plot_U_vs_y() {
setup="$1"
endTime="$2"
# benchmarkFile="ReTau-395/dataset/chan395.means"
benchmarkFile="$FOAM_TUTORIALS/verificationAndValidation/turbulentInflow/oneCellThickPlaneChannel/resources/dataset/chan395.means"
n=0
m=0
for l in {1..11}
do
m=$(($m+5))
sampleFiles[$n]="results/$setup/postProcessing/sample/$endTime/l${m}_columnAverage:columnAverage(UMean).xy"
sampleFiles[$n]="results/$setup/postProcessing/sampleUMean/$endTime/l${m}_columnAverage(UMean).xy"
n=$(($n+1))
done
@ -194,18 +196,18 @@ plot_U_vs_y() {
set output "$image"
set multiplot layout 1,11 title "Setup: $setup" noenhanced
# Benchmark - Experimental
# benchmark="$benchmarkFile"
# Benchmark
benchmark="$benchmarkFile"
# OpenFOAM - Numerical
# OpenFOAM
samples="${sampleFiles[*]}"
list="5h 10h 15h 20h 25h 30h 35h 40h 45h 50h 55h"
do for [i = 1:11] {
if (i != 1) { unset ylabel }
plot \
word(samples, i) u 2:1 t word(list, i) w l lw 2 lc rgb "#4169e1"
# benchmark every 4 u 3:1 t "DNS" w p ps 2 pt 7 lc rgb "#D55E00"
word(samples, i) u 2:1 t word(list, i) w l lw 2 lc rgb "#4169e1", \
benchmark every 4 u 3:1 t "DNS" w p ps 2 pt 7 lc rgb "#D55E00"
}
unset multiplot
@ -226,18 +228,18 @@ PLT_U_VS_Y
set output "$image"
set multiplot layout 1,11 title "Setup: $setup" noenhanced
# Benchmark - Experimental
# benchmark="$benchmarkFile"
# Benchmark
benchmark="$benchmarkFile"
# OpenFOAM - Numerical
# OpenFOAM
samples="${sampleFiles[*]}"
list="5h 10h 15h 20h 25h 30h 35h 40h 45h 50h 55h"
do for [i = 1:11] {
if (i != 1) { unset ylabel }
plot \
word(samples, i) u 3:1 t word(list, i) w l lw 2 lc rgb "#4169e1"
# benchmark every 4 u 5:1 t "DNS" w p ps 2 pt 7 lc rgb "#D55E00"
word(samples, i) u 3:1 t word(list, i) w l lw 2 lc rgb "#4169e1", \
benchmark every 4 u 5:1 t "DNS" w p ps 2 pt 7 lc rgb "#D55E00"
}
unset multiplot
@ -258,18 +260,18 @@ PLT_V_VS_Y
set output "$image"
set multiplot layout 1,11 title "Setup: $setup" noenhanced
# Benchmark - Experimental
# benchmark="$benchmarkFile"
# Benchmark
benchmark="$benchmarkFile"
# OpenFOAM - Numerical
# OpenFOAM
samples="${sampleFiles[*]}"
list="5h 10h 15h 20h 25h 30h 35h 40h 45h 50h 55h"
do for [i = 1:11] {
if (i != 1) { unset ylabel }
plot \
word(samples, i) u 4:1 t word(list, i) w l lw 2 lc rgb "#4169e1"
# benchmark every 4 u 5:1 t "DNS" w p ps 2 pt 7 lc rgb "#D55E00"
word(samples, i) u 4:1 t word(list, i) w l lw 2 lc rgb "#4169e1", \
benchmark every 4 u 5:1 t "DNS" w p ps 2 pt 7 lc rgb "#D55E00"
}
unset multiplot
@ -299,7 +301,7 @@ plot_x_vs_cf() {
set ylabel "C_f"
set output "$image"
# OpenFOAM - Numerical
# OpenFOAM
samples="$sampleFile"
plot samples u 1:4 t "OpenFOAM" w l lw 2 lc rgb "#4169e1"
@ -313,9 +315,10 @@ plot_yPlus_vs_u() {
endTime="$2"
nu="$3"
# benchmarkFile="ReTau-395/dataset/chan395.means"
sampleFile_patch="results/$setup/postProcessing/sample/$endTime/inletPatch_columnAverage:columnAverage(UMean).xy"
sampleFile_cell="results/$setup/postProcessing/sample/$endTime/inletCell_columnAverage:columnAverage(UMean).xy"
benchmarkFile="$FOAM_TUTORIALS/verificationAndValidation/turbulentInflow/oneCellThickPlaneChannel/resources/dataset/chan395.means"
sampleFile_patch="results/$setup/postProcessing/sampleUMean/$endTime/inletPatch_columnAverage(UMean).xy"
sampleFile_cell="results/$setup/postProcessing/sampleUMean/$endTime/inletCell_columnAverage(UMean).xy"
image_patch="plots/$setup/yPlus_vs_u_patch.png"
image_cell="plots/$setup/yPlus_vs_u_cell.png"
@ -333,22 +336,22 @@ plot_yPlus_vs_u() {
set output "$image_patch"
set title "Setup: $setup (inlet patch face)" noenhanced
# Benchmark - Experimental
# benchmark="$benchmarkFile"
# Benchmark
benchmark="$benchmarkFile"
# OpenFOAM - Numerical
# OpenFOAM
samples_patch="$sampleFile_patch"
samples_cell="$sampleFile_cell"
plot \
samples_patch u (\$1/$nu):2 t "OpenFOAM" w l lw 2 lc rgb "#4169e1"
# benchmark u 2:3 t "DNS" w p ps 2 pt 7 lc rgb "#D55E00"
samples_patch u (\$1/$nu):2 t "OpenFOAM" w l lw 2 lc rgb "#4169e1", \
benchmark u 2:3 t "DNS" w p ps 2 pt 7 lc rgb "#D55E00"
set output "$image_cell"
set title "Setup: $setup (inlet patch cell)" noenhanced
plot \
samples_cell u (\$1/$nu):2 t "OpenFOAM" w l lw 2 lc rgb "#4169e1"
# benchmark u 2:3 t "DNS" w p ps 2 pt 7 lc rgb "#D55E00"
samples_cell u (\$1/$nu):2 t "OpenFOAM" w l lw 2 lc rgb "#4169e1", \
benchmark u 2:3 t "DNS" w p ps 2 pt 7 lc rgb "#D55E00"
PLT_Y_VS_U
}
@ -359,8 +362,8 @@ plot_yPlus_vs_R_patch() {
endTime="$2"
nu="$3"
# benchmarkFile="ReTau-395/dataset/chan395.reystress"
sampleFile="results/$setup/postProcessing/sample/$endTime/inletPatch_columnAverage:columnAverage(UPrime2Mean).xy"
benchmarkFile="$FOAM_TUTORIALS/verificationAndValidation/turbulentInflow/oneCellThickPlaneChannel/resources/dataset/chan395.reystress"
sampleFile="results/$setup/postProcessing/sampleUPrime2Mean/$endTime/inletPatch_columnAverage(UPrime2Mean).xy"
imageUU="plots/$setup/yPlus_vs_Ruu_patch.png"
imageVV="plots/$setup/yPlus_vs_Rvv_patch.png"
imageWW="plots/$setup/yPlus_vs_Rww_patch.png"
@ -380,33 +383,33 @@ plot_yPlus_vs_R_patch() {
set output "$imageUU"
set title "Setup: $setup (inlet patch face)" noenhanced
# Benchmark - DNS
# benchmark = "$benchmarkFile"
# Benchmark
benchmark = "$benchmarkFile"
# Samples - OpenFOAM
# OpenFOAM
samples="$sampleFile"
plot \
samples u (\$1/$nu):2 t "OpenFOAM" w l lw 2 lc rgb "#4169e1"
# benchmark u 2:3 t "DNS" w l lw 2 dt 2 lc rgb "#D55E00"
samples u (\$1/$nu):2 t "OpenFOAM" w l lw 2 lc rgb "#4169e1", \
benchmark u 2:3 t "DNS" w l lw 2 dt 2 lc rgb "#D55E00"
set output "$imageVV"
set ylabel "(vv)^+"
plot \
samples u (\$1/$nu):5 t "OpenFOAM" w l lw 2 lc rgb "#4169e1"
# benchmark u 2:4 t "DNS" w l lw 2 dt 2 lc rgb "#D55E00"
samples u (\$1/$nu):5 t "OpenFOAM" w l lw 2 lc rgb "#4169e1", \
benchmark u 2:4 t "DNS" w l lw 2 dt 2 lc rgb "#D55E00"
set output "$imageWW"
set ylabel "(ww)^+"
plot \
samples u (\$1/$nu):7 t "OpenFOAM" w l lw 2 lc rgb "#4169e1"
# benchmark u 2:5 t "DNS" w l lw 2 dt 2 lc rgb "#D55E00"
samples u (\$1/$nu):7 t "OpenFOAM" w l lw 2 lc rgb "#4169e1", \
benchmark u 2:5 t "DNS" w l lw 2 dt 2 lc rgb "#D55E00"
set output "$imageUV"
set ylabel "(uv)^+"
plot \
samples u (\$1/$nu):(-\$3) t "OpenFOAM" w l lw 2 lc rgb "#4169e1"
# benchmark u 2:(\$6*-1) t "DNS" w l lw 2 dt 2 lc rgb "#D55E00"
samples u (\$1/$nu):(-\$3) t "OpenFOAM" w l lw 2 lc rgb "#4169e1", \
benchmark u 2:(\$6*-1) t "DNS" w l lw 2 dt 2 lc rgb "#D55E00"
PLT_Y_VS_R_PATCH
}
@ -417,9 +420,8 @@ plot_yPlus_vs_R_cell() {
endTime="$2"
nu="$3"
endTime=$(foamDictionary results/$setup/settings/controlDict -entry endTime -value)
# benchmarkFile="ReTau-395/dataset/chan395.reystress"
sampleFile="results/$setup/postProcessing/sample/$endTime/inletCell_columnAverage:columnAverage(UPrime2Mean).xy"
benchmarkFile="$FOAM_TUTORIALS/verificationAndValidation/turbulentInflow/oneCellThickPlaneChannel/resources/dataset/chan395.reystress"
sampleFile="results/$setup/postProcessing/sampleUPrime2Mean/$endTime/inletCell_columnAverage(UPrime2Mean).xy"
imageUU="plots/$setup/yPlus_vs_Ruu_cell.png"
imageVV="plots/$setup/yPlus_vs_Rvv_cell.png"
imageWW="plots/$setup/yPlus_vs_Rww_cell.png"
@ -439,33 +441,33 @@ plot_yPlus_vs_R_cell() {
set output "$imageUU"
set title "Setup: $setup (inlet patch cell)" noenhanced
# Benchmark - DNS
# benchmark = "$benchmarkFile"
# Benchmark
benchmark = "$benchmarkFile"
# Samples - OpenFOAM
# OpenFOAM
samples="$sampleFile"
plot \
samples u (\$1/$nu):2 t "OpenFOAM" w l lw 2 lc rgb "#4169e1"
# benchmark u 2:3 t "DNS" w l lw 2 dt 2 lc rgb "#D55E00"
samples u (\$1/$nu):2 t "OpenFOAM" w l lw 2 lc rgb "#4169e1", \
benchmark u 2:3 t "DNS" w l lw 2 dt 2 lc rgb "#D55E00"
set output "$imageVV"
set ylabel "(vv)^+"
plot \
samples u (\$1/$nu):5 t "OpenFOAM" w l lw 2 lc rgb "#4169e1"
# benchmark u 2:4 t "DNS" w l lw 2 dt 2 lc rgb "#D55E00"
samples u (\$1/$nu):5 t "OpenFOAM" w l lw 2 lc rgb "#4169e1", \
benchmark u 2:4 t "DNS" w l lw 2 dt 2 lc rgb "#D55E00"
set output "$imageWW"
set ylabel "(ww)^+"
plot \
samples u (\$1/$nu):7 t "OpenFOAM" w l lw 2 lc rgb "#4169e1"
# benchmark u 2:5 t "DNS" w l lw 2 dt 2 lc rgb "#D55E00"
samples u (\$1/$nu):7 t "OpenFOAM" w l lw 2 lc rgb "#4169e1", \
benchmark u 2:5 t "DNS" w l lw 2 dt 2 lc rgb "#D55E00"
set output "$imageUV"
set ylabel "(uv)^+"
plot \
samples u (\$1/$nu):(-\$3) t "OpenFOAM" w l lw 2 lc rgb "#4169e1"
# benchmark u 2:(\$6*-1) t "DNS" w l lw 2 dt 2 lc rgb "#D55E00"
samples u (\$1/$nu):(-\$3) t "OpenFOAM" w l lw 2 lc rgb "#4169e1", \
benchmark u 2:(\$6*-1) t "DNS" w l lw 2 dt 2 lc rgb "#D55E00"
PLT_Y_VS_R_CELL
}
@ -475,8 +477,8 @@ plot_R_patch() {
setup="$1"
endTime="$2"
# benchmarkFile="ReTau-395/dataset/chan395.reystress"
sampleFile="results/$setup/postProcessing/sample/$endTime/inletPatch_columnAverage:columnAverage(UPrime2Mean).xy"
benchmarkFile="$FOAM_TUTORIALS/verificationAndValidation/turbulentInflow/oneCellThickPlaneChannel/resources/dataset/chan395.reystress"
sampleFile="results/$setup/postProcessing/sampleUPrime2Mean/$endTime/inletPatch_columnAverage(UPrime2Mean).xy"
image="plots/$setup/R_patch.png"
gnuplot<<PLT_R_PATCH
@ -493,21 +495,21 @@ plot_R_patch() {
set output "$image"
set title "Reynolds stresses on patch"
# Benchmark - DNS
# benchmark = "$benchmarkFile"
# Benchmark
benchmark = "$benchmarkFile"
# Samples - OpenFOAM
# OpenFOAM
samples="$sampleFile"
plot \
samples u 1:2 t "<u^' u^'>" w l lw 2 lc rgb "#009E73", \
samples u 1:5 t "<v^' v^'>" w l lw 2 lc rgb "#F0E440", \
samples u 1:7 t "<w^' w^'>" w l lw 2 lc rgb "#0072B2", \
samples u 1:3 t "<u^' v^'>" w l lw 2 lc rgb "#D55E00"
#benchmark u 1:3 t "<u^' u^'>_{DNS}" w l lw 2 dt 2 lc rgb "#009E73", \
#benchmark u 1:4 t "<v^' v^'>_{DNS}" w l lw 2 dt 2 lc rgb "#F0E440", \
#benchmark u 1:5 t "<w^' w^'>_{DNS}" w l lw 2 dt 2 lc rgb "#0072B2", \
#benchmark u 1:6 t "<u^' v^'>_{DNS}" w l lw 2 dt 2 lc rgb "#D55E00"
samples u 1:3 t "<u^' v^'>" w l lw 2 lc rgb "#D55E00", \
benchmark u 1:3 t "<u^' u^'>_{DNS}" w l lw 2 dt 2 lc rgb "#009E73", \
benchmark u 1:4 t "<v^' v^'>_{DNS}" w l lw 2 dt 2 lc rgb "#F0E440", \
benchmark u 1:5 t "<w^' w^'>_{DNS}" w l lw 2 dt 2 lc rgb "#0072B2", \
benchmark u 1:6 t "<u^' v^'>_{DNS}" w l lw 2 dt 2 lc rgb "#D55E00"
PLT_R_PATCH
}
@ -517,8 +519,8 @@ plot_R_cell() {
setup="$1"
endTime="$2"
# benchmarkFile="ReTau-395/dataset/chan395.reystress"
sampleFile="results/$setup/postProcessing/sample/$endTime/inletCell_columnAverage:columnAverage(UPrime2Mean).xy"
benchmarkFile="$FOAM_TUTORIALS/verificationAndValidation/turbulentInflow/oneCellThickPlaneChannel/resources/dataset/chan395.reystress"
sampleFile="results/$setup/postProcessing/sampleUPrime2Mean/$endTime/inletCell_columnAverage(UPrime2Mean).xy"
image="plots/$setup/R_cell.png"
gnuplot<<PLT_R_CELL
@ -535,21 +537,21 @@ plot_R_cell() {
set output "$image"
set title "Reynolds stresses on cell"
# Benchmark - DNS
# benchmark = "$benchmarkFile"
# Benchmark
benchmark = "$benchmarkFile"
# Samples - OpenFOAM
# OpenFOAM
samples="$sampleFile"
plot \
samples u 1:2 t "<u^' u^'>" w l lw 2 lc rgb "#009E73", \
samples u 1:5 t "<v^' v^'>" w l lw 2 lc rgb "#F0E440", \
samples u 1:7 t "<w^' w^'>" w l lw 2 lc rgb "#0072B2", \
samples u 1:3 t "<u^' v^'>" w l lw 2 lc rgb "#D55E00"
#benchmark u 1:3 t "<u^' u^'>_{DNS}" w l lw 2 dt 2 lc rgb "#009E73", \
#benchmark u 1:4 t "<v^' v^'>_{DNS}" w l lw 2 dt 2 lc rgb "#F0E440", \
#benchmark u 1:5 t "<w^' w^'>_{DNS}" w l lw 2 dt 2 lc rgb "#0072B2", \
#benchmark u 1:6 t "<u^' v^'>_{DNS}" w l lw 2 dt 2 lc rgb "#D55E00"
samples u 1:3 t "<u^' v^'>" w l lw 2 lc rgb "#D55E00", \
benchmark u 1:3 t "<u^' u^'>_{DNS}" w l lw 2 dt 2 lc rgb "#009E73", \
benchmark u 1:4 t "<v^' v^'>_{DNS}" w l lw 2 dt 2 lc rgb "#F0E440", \
benchmark u 1:5 t "<w^' w^'>_{DNS}" w l lw 2 dt 2 lc rgb "#0072B2", \
benchmark u 1:6 t "<u^' v^'>_{DNS}" w l lw 2 dt 2 lc rgb "#D55E00"
PLT_R_CELL
}
@ -573,17 +575,21 @@ command -v gnuplot >/dev/null || {
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"
# few manipulations
endTime=$(foamDictionary results/$setup/settings/controlDict -entry endTime -value)
nu=$(foamDictionary results/$setup/settings/transportProperties -entry nu | sed 's|^.*\s\(.*\);|\1|g')
endTime=$(foamDictionary results/"$setup"/system/controlDict -entry endTime -value)
nu=$(foamDictionary results/"$setup"/constant/transportProperties -entry nu | sed 's|^.*\s\(.*\);|\1|g')
plot_yPlus_vs_u "$setup" "$endTime" "$nu"
@ -600,7 +606,6 @@ do
plot_U_vs_y "$setup" "$endTime"
plot_x_vs_cf "$setup" "$endTime"
done

View File

@ -0,0 +1,65 @@
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: v2206 |
| \\ / A nd | Website: www.openfoam.com |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class volVectorField;
object U;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
dimensions [0 1 -1 0 0 0 0];
internalField uniform (17.55 0 0);
boundaryField
{
inlet
{
type turbulentDigitalFilterInlet;
n ( 64 70 );
L
(
0.04446467692 0.01771245128 0.01950205128
0.172787596 0.171889998 0.224578995
0.1728125 0.171875 0.22459375
);
mean
{
type mappedFile;
mapMethod nearest;
fieldTable U;
}
R
{
type mappedFile;
mapMethod nearest;
}
value $internalField;
}
outlet
{
type advective;
value $internalField;
}
"(bottom|top)"
{
type noSlip;
}
"(left|right)"
{
type cyclic;
}
}
// ************************************************************************* //

View File

@ -1,7 +1,7 @@
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: v2112 |
| \\ / O peration | Version: v2206 |
| \\ / A nd | Website: www.openfoam.com |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/

View File

@ -1 +0,0 @@
../../common/constant/transportProperties

View File

@ -1 +0,0 @@
../../common/constant/turbulenceProperties

View File

@ -0,0 +1,66 @@
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: v2206 |
| \\ / A nd | Website: www.openfoam.com |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class volVectorField;
object U;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
dimensions [0 1 -1 0 0 0 0];
internalField uniform (17.55 0 0);
boundaryField
{
inlet
{
type turbulentDigitalFilterInlet;
fsm true;
n ( 64 70 );
L
(
0.04446467692 0.01771245128 0.01950205128
0.172787596 0.171889998 0.224578995
0.1728125 0.171875 0.22459375
);
mean
{
type mappedFile;
mapMethod nearest;
fieldTable U;
}
R
{
type mappedFile;
mapMethod nearest;
}
value $internalField;
}
outlet
{
type advective;
value $internalField;
}
"(bottom|top)"
{
type noSlip;
}
"(left|right)"
{
type cyclic;
}
}
// ************************************************************************* //

View File

@ -1,7 +1,7 @@
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: v2112 |
| \\ / O peration | Version: v2206 |
| \\ / A nd | Website: www.openfoam.com |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/

View File

@ -1,7 +1,7 @@
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: v2112 |
| \\ / O peration | Version: v2206 |
| \\ / A nd | Website: www.openfoam.com |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/

View File

@ -0,0 +1,8 @@
#!/bin/sh
cd "${0%/*}" || exit # Run from this directory
. ${WM_PROJECT_DIR:?}/bin/tools/CleanFunctions # Tutorial clean functions
#------------------------------------------------------------------------------
cleanCase0
#------------------------------------------------------------------------------

View File

@ -0,0 +1,15 @@
#!/bin/sh
cd "${0%/*}" || exit # Run from this directory
. ${WM_PROJECT_DIR:?}/bin/tools/RunFunctions # Tutorial run functions
#------------------------------------------------------------------------------
./Allrun.pre
runApplication $(getApplication)
runApplication -s "columnAverage" postProcess -func columnAverage -latestTime
runApplication -s "UMean" postProcess -func sampleUMean -latestTime
runApplication -s "UPrime2Mean" postProcess -func sampleUPrime2Mean -latestTime
runApplication -s "Cf" postProcess -func sampleCf -latestTime
#------------------------------------------------------------------------------

View File

@ -0,0 +1,19 @@
#!/bin/sh
cd "${0%/*}" || exit # Run from this directory
. ${WM_PROJECT_DIR:?}/bin/tools/RunFunctions # Tutorial run functions
#------------------------------------------------------------------------------
./Allrun.pre
runApplication decomposePar
runParallel $(getApplication)
runApplication reconstructPar
runApplication -s "columnAverage" postProcess -func columnAverage -latestTime
runApplication -s "UMean" postProcess -func sampleUMean -latestTime
runApplication -s "UPrime2Mean" postProcess -func sampleUPrime2Mean -latestTime
runApplication -s "Cf" postProcess -func sampleCf -latestTime
#------------------------------------------------------------------------------

View File

@ -0,0 +1,17 @@
#!/bin/sh
cd "${0%/*}" || exit # Run from this directory
. ${WM_PROJECT_DIR:?}/bin/tools/RunFunctions # Tutorial run functions
#------------------------------------------------------------------------------
if [ ! -d constant/polyMesh ]
then
runApplication blockMesh
runApplication renumberMesh -overwrite -constant
runApplication checkMesh -allTopology -allGeometry -constant
fi
restore0Dir
#------------------------------------------------------------------------------

View File

@ -1,7 +1,7 @@
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: v2112 |
| \\ / O peration | Version: v2206 |
| \\ / A nd | Website: www.openfoam.com |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/

View File

@ -1,7 +1,7 @@
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: v2112 |
| \\ / O peration | Version: v2206 |
| \\ / A nd | Website: www.openfoam.com |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/

View File

@ -1,7 +1,7 @@
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: v2112 |
| \\ / O peration | Version: v2206 |
| \\ / A nd | Web: www.openfoam.com |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/

View File

@ -1,7 +1,7 @@
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: v2112 |
| \\ / O peration | Version: v2206 |
| \\ / A nd | Website: www.openfoam.com |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
@ -22,7 +22,7 @@ startTime 0;
stopAt endTime;
endTime 10; // 180;
endTime 180;
deltaT 2e-3;
@ -70,53 +70,44 @@ functions
type coded;
libs (utilityFunctionObjects);
name Cf;
timeStart $/timeStart;
writeControl writeTime;
codeExecute
#{
static autoPtr<volScalarField> Cf;
if
(
mesh().time().timeIndex() == 1
||
mesh().time().startTimeIndex() == mesh().time().timeIndex() - 1
)
auto* CfPtr =
mesh().getObjectPtr<volScalarField>("Cf");
if (!CfPtr)
{
Info<< "Create skin-friction coefficient field" << nl;
Cf.set
CfPtr = new volScalarField
(
new volScalarField
IOobject
(
IOobject
(
"Cf",
mesh().time().timeName(),
mesh(),
IOobject::NO_READ,
IOobject::AUTO_WRITE
),
"Cf",
mesh().time().timeName(),
mesh(),
dimless
)
IOobject::NO_READ,
IOobject::AUTO_WRITE
),
mesh(),
dimless
);
regIOobject::store(CfPtr);
}
if
(
mesh().time().timeIndex() != 1
&& mesh().time().timeIndex() > 3 // 60 // = timeStart
)
{
Info<< "Computing skin-friction coefficient field" << endl;
auto& Cf = *CfPtr;
const auto& tau =
mesh().lookupObject<volVectorField>("wallShearStress");
auto& Cf = mesh().lookupObjectRef<volScalarField>("Cf");
Info<< "Computing skin-friction coefficient field\n" << endl;
const dimensionedScalar Ubulk(dimVelocity, 17.55);
const auto& tau =
mesh().lookupObject<volVectorField>("wallShearStress");
Cf = mag(tau.component(0))/(0.5*sqr(Ubulk));
}
const dimensionedScalar Ubulk(dimVelocity, 17.55);
Cf = mag(tau.component(0))/(0.5*sqr(Ubulk));
#};
}

View File

@ -1,7 +1,7 @@
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: v2112 |
| \\ / O peration | Version: v2206 |
| \\ / A nd | Website: www.openfoam.com |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/

View File

@ -1,7 +1,7 @@
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: v2112 |
| \\ / O peration | Version: v2206 |
| \\ / A nd | Website: www.openfoam.com |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/

View File

@ -1,7 +1,7 @@
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: v2112 |
| \\ / O peration | Version: v2206 |
| \\ / A nd | Website: www.openfoam.com |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/

View File

@ -2,7 +2,7 @@
type sets;
libs (sampling);
interpolationScheme cellPatchConstrained;
interpolationScheme cellPoint;
setFormat raw;
fields ( CfMean );

View File

@ -2,13 +2,12 @@
type sets;
libs (sampling);
interpolationScheme cellPatchConstrained;
interpolationScheme cellPoint;
setFormat raw;
fields
(
columnAverage:columnAverage(UMean)
columnAverage:columnAverage(UPrime2Mean)
columnAverage(UMean)
);
sets

View File

@ -0,0 +1,213 @@
// -*- C++ -*-
type sets;
libs (sampling);
interpolationScheme cellPoint;
setFormat raw;
fields
(
columnAverage(UPrime2Mean)
);
sets
{
inletPatch
{
type face;
axis y;
start (0.0 0 1.57);
end (0.0 2 1.57);
}
inletCell
{
type midPoint;
axis y;
start (0.062832 0 1.57);
end (0.062832 2 1.57);
}
l1 // 1, 5, 10, ... delta
{
type uniform;
axis distance;
start (0.1 0.0 1.57);
end (0.1 2.0 1.57);
nPoints 200;
}
l5
{
type uniform;
axis distance;
start (5.0 0.0 1.57);
end (5.0 2.0 1.57);
nPoints 200;
}
l10
{
type uniform;
axis distance;
start (10.0 0.0 1.57);
end (10.0 2.0 1.57);
nPoints 200;
}
l15
{
type uniform;
axis distance;
start (15.0 0.0 1.57);
end (15.0 2.0 1.57);
nPoints 200;
}
l20
{
type uniform;
axis distance;
start (20.0 0.0 1.57);
end (20.0 2.0 1.57);
nPoints 200;
}
l25
{
type uniform;
axis distance;
start (25.0 0.0 1.57);
end (25.0 2.0 1.57);
nPoints 200;
}
l30
{
type uniform;
axis distance;
start (30.0 0.0 1.57);
end (30.0 2.0 1.57);
nPoints 200;
}
l35
{
type uniform;
axis distance;
start (35.0 0.0 1.57);
end (35.0 2.0 1.57);
nPoints 200;
}
l40
{
type uniform;
axis distance;
start (40.0 0.0 1.57);
end (40.0 2.0 1.57);
nPoints 200;
}
l45
{
type uniform;
axis distance;
start (45.0 0.0 1.57);
end (45.0 2.0 1.57);
nPoints 200;
}
l50
{
type uniform;
axis distance;
start (50.0 0.0 1.57);
end (50.0 2.0 1.57);
nPoints 200;
}
l55
{
type uniform;
axis distance;
start (55.0 0.0 1.57);
end (55.0 2.0 1.57);
nPoints 200;
}
Poletto0 // Poletto et al.
{
type uniform;
axis distance;
start (0.1 0.0 1.57);
end (0.1 2.0 1.57);
nPoints 200;
}
Poletto36
{
type uniform;
axis distance;
start (3.6 0.0 1.57);
end (3.6 2.0 1.57);
nPoints 200;
}
Poletto75
{
type uniform;
axis distance;
start (7.5 0.0 1.57);
end (7.5 2.0 1.57);
nPoints 200;
}
Poletto113
{
type uniform;
axis distance;
start (11.3 0.0 1.57);
end (11.3 2.0 1.57);
nPoints 200;
}
Poletto151
{
type uniform;
axis distance;
start (15.1 0.0 1.57);
end (15.1 2.0 1.57);
nPoints 200;
}
Poletto226
{
type uniform;
axis distance;
start (22.6 0.0 1.57);
end (22.6 2.0 1.57);
nPoints 200;
}
Poletto302
{
type uniform;
axis distance;
start (30.2 0.0 1.57);
end (30.2 2.0 1.57);
nPoints 200;
}
Poletto377
{
type uniform;
axis distance;
start (37.7 0.0 1.57);
end (37.7 2.0 1.57);
nPoints 200;
}
}
// ************************************************************************* //