mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
TUT: basic, IO, preProcessing, VV: clean up tutorials
- TUT: mesh: add missing SnakeRiverCanyon files - TUT: mesh: add missing cp source in a foamyHexMesh tutorial
This commit is contained in:
@ -1,21 +0,0 @@
|
||||
#!/bin/sh
|
||||
cd "${0%/*}" || exit # Run from this directory
|
||||
. ${WM_PROJECT_DIR:?}/bin/tools/RunFunctions # Tutorial run functions
|
||||
#------------------------------------------------------------------------------
|
||||
|
||||
restore0Dir
|
||||
|
||||
cp -rf $FOAM_TUTORIALS/resources/dataset/atm-HargreavesWright-2007 system/.
|
||||
|
||||
rasModel="kEpsilon" # Tested options="kOmegaSST","kEpsilon"
|
||||
|
||||
sed "s|RAS_MODEL|$rasModel|g" constant/turbulenceProperties.template > \
|
||||
constant/turbulenceProperties
|
||||
|
||||
runApplication blockMesh
|
||||
|
||||
runApplication renumberMesh -overwrite
|
||||
|
||||
runApplication $(getApplication)
|
||||
|
||||
#------------------------------------------------------------------------------
|
||||
@ -1,23 +0,0 @@
|
||||
#!/bin/sh
|
||||
cd "${0%/*}" || exit # Run from this directory
|
||||
. ${WM_PROJECT_DIR:?}/bin/tools/RunFunctions # Tutorial run functions
|
||||
#------------------------------------------------------------------------------
|
||||
|
||||
restore0Dir
|
||||
|
||||
rasModel="kEpsilon" # Tested options="kOmegaSST","kEpsilon"
|
||||
|
||||
sed "s|RAS_MODEL|$rasModel|g" constant/turbulenceProperties.template > \
|
||||
constant/turbulenceProperties
|
||||
|
||||
runApplication blockMesh
|
||||
|
||||
runApplication decomposePar
|
||||
|
||||
runParallel renumberMesh -overwrite
|
||||
|
||||
runParallel $(getApplication)
|
||||
|
||||
runParallel redistributePar -reconstruct -latestTime
|
||||
|
||||
#------------------------------------------------------------------------------
|
||||
@ -1,339 +0,0 @@
|
||||
#!/bin/sh
|
||||
cd "${0%/*}" || exit # Run from this directory
|
||||
. ${WM_PROJECT_DIR:?}/bin/tools/RunFunctions # Tutorial run functions
|
||||
#------------------------------------------------------------------------------
|
||||
|
||||
# Postprocess according to the existence of "epsilon" or "omega"
|
||||
baseEpsilonOrOmega="epsilon" # options: "epsilon", "omega".
|
||||
|
||||
# Note: Benchmark data is available for the standard k-epsilon model from:
|
||||
# Hargreaves, D. M., & Wright, N. G. (2007).
|
||||
# On the use of the k–ε model in commercial CFD software
|
||||
# to model the neutral atmospheric boundary layer.
|
||||
# Journal of wind engineering and
|
||||
# industrial aerodynamics, 95(5), 355-369.
|
||||
# DOI:10.1016/j.jweia.2006.08.002
|
||||
# Figure 6.
|
||||
#------------------------------------------------------------------------------
|
||||
|
||||
plotUxUpstream() {
|
||||
timeDir=$1
|
||||
zMin=$2
|
||||
echo " Plotting the ground-normal flow speed profile (upstream)."
|
||||
|
||||
outName="plots/Ux_upstream.png"
|
||||
gnuplot<<PLT_UX_UPSTREAM
|
||||
set terminal pngcairo font "helvetica,20" size 1000, 800
|
||||
set xrange [4:18]
|
||||
set yrange [0:50]
|
||||
set grid
|
||||
set key top left
|
||||
set xlabel "Ux [m s^{-1}]"
|
||||
set ylabel "Non-dimensionalised height, z/z_{ref}"
|
||||
set offset .05, .05
|
||||
set output "$outName"
|
||||
|
||||
zRef = 6
|
||||
inp0="$timeDir/x_0mCell_U.xy"
|
||||
inp1="$timeDir/x_0mPatch_U.xy"
|
||||
|
||||
plot \
|
||||
"system/atm-HargreavesWright-2007/Ux-HW-RH-Fig6a" \
|
||||
u 1:2 t "RH" w p ps 2 pt 6 lc rgb "#000000", \
|
||||
"system/atm-HargreavesWright-2007/Ux-HW-RH-Fig6a" \
|
||||
u 1:2 t "HW, x=2500m" w p ps 1 pt 5 lc rgb "#E69F00", \
|
||||
"system/atm-HargreavesWright-2007/Ux-HW-RH-Fig6a" \
|
||||
u 1:2 t "HW, x=4000m" w p ps 0.5 pt 4 lc rgb "#56B4E9", \
|
||||
inp0 u 2:((\$1-$zMin)/zRef) t "OF, x=0m (Patch)" w l lw 2 lc rgb "#009E73", \
|
||||
inp1 u 2:((\$1-$zMin)/zRef) t "OF, x=0m (Cell)" w l lw 2 lc rgb "#F0E440"
|
||||
PLT_UX_UPSTREAM
|
||||
}
|
||||
|
||||
|
||||
plotUxMid() {
|
||||
timeDir=$1
|
||||
zMin=$2
|
||||
echo " Plotting the ground-normal flow speed profile (mid-range)."
|
||||
|
||||
outName="plots/Ux_mid.png"
|
||||
gnuplot<<PLT_UX_MID
|
||||
set terminal pngcairo font "helvetica,20" size 1000, 800
|
||||
set xrange [4:18]
|
||||
set yrange [0:50]
|
||||
set grid
|
||||
set key top left
|
||||
set xlabel "Ux [m s^{-1}]"
|
||||
set ylabel "Non-dimensionalised height, z/z_{ref}"
|
||||
set offset .05, .05
|
||||
set output "$outName"
|
||||
|
||||
zRef = 6
|
||||
inp2="$timeDir/x_2500m_U.xy"
|
||||
inp3="$timeDir/x_4000m_U.xy"
|
||||
|
||||
plot \
|
||||
"system/atm-HargreavesWright-2007/Ux-HW-RH-Fig6a" \
|
||||
u 1:2 t "RH" w p ps 2 pt 6 lc rgb "#000000", \
|
||||
"system/atm-HargreavesWright-2007/Ux-HW-RH-Fig6a" \
|
||||
u 1:2 t "HW, x=2500m" w p ps 1 pt 5 lc rgb "#E69F00", \
|
||||
"system/atm-HargreavesWright-2007/Ux-HW-RH-Fig6a" \
|
||||
u 1:2 t "HW, x=4000m" w p ps 0.5 pt 4 lc rgb "#56B4E9", \
|
||||
inp2 u 2:((\$1-$zMin)/zRef) t "OF, x=2500m" w l lw 2 lc rgb "#0072B2", \
|
||||
inp3 u 2:((\$1-$zMin)/zRef) t "OF, x=4000m" w l lw 2 lc rgb "#D55E00"
|
||||
PLT_UX_MID
|
||||
}
|
||||
|
||||
|
||||
plotUxDownstream() {
|
||||
timeDir=$1
|
||||
zMin=$2
|
||||
echo " Plotting the ground-normal flow speed profile (downstream)."
|
||||
|
||||
outName="plots/Ux_downstream.png"
|
||||
gnuplot<<PLT_UX_DOWNSTREAM
|
||||
set terminal pngcairo font "helvetica,20" size 1000, 800
|
||||
set xrange [4:18]
|
||||
set yrange [0:50]
|
||||
set grid
|
||||
set key top left
|
||||
set xlabel "Ux [m s^{-1}]"
|
||||
set ylabel "Non-dimensionalised height, z/z_{ref}"
|
||||
set offset .05, .05
|
||||
set output "$outName"
|
||||
|
||||
zRef = 6
|
||||
inp4="$timeDir/x_5000mCell_U.xy"
|
||||
inp5="$timeDir/x_5000mPatch_U.xy"
|
||||
|
||||
plot \
|
||||
"system/atm-HargreavesWright-2007/Ux-HW-RH-Fig6a" \
|
||||
u 1:2 t "RH" w p ps 2 pt 6 lc rgb "#000000", \
|
||||
"system/atm-HargreavesWright-2007/Ux-HW-RH-Fig6a" \
|
||||
u 1:2 t "HW, x=2500m" w p ps 1 pt 5 lc rgb "#E69F00", \
|
||||
"system/atm-HargreavesWright-2007/Ux-HW-RH-Fig6a" \
|
||||
u 1:2 t "HW, x=4000m" w p ps 0.5 pt 4 lc rgb "#56B4E9", \
|
||||
inp4 u 2:((\$1-$zMin)/zRef) t "OF, x=5000m (Cell)" w l lw 2 lc rgb "#CC79A7", \
|
||||
inp5 u 2:((\$1-$zMin)/zRef) t "OF, x=5000m (Patch)" w l lw 2 lc rgb "#440154"
|
||||
PLT_UX_DOWNSTREAM
|
||||
}
|
||||
|
||||
|
||||
plotK() {
|
||||
timeDir=$1
|
||||
items=$2
|
||||
seq=$3
|
||||
zMin=$4
|
||||
echo " Plotting the ground-normal turbulent kinetic energy profile."
|
||||
|
||||
outName="plots/k.png"
|
||||
gnuplot<<PLT_K
|
||||
set terminal pngcairo font "helvetica,20" size 1000, 800
|
||||
set xrange [1:2]
|
||||
set yrange [0:50]
|
||||
set grid
|
||||
set key top right
|
||||
set xlabel "k [m^2 s^{-2}]"
|
||||
set ylabel "Non-dimensionalised height, z/z_{ref}"
|
||||
set offset .05, .05
|
||||
set output "$outName"
|
||||
|
||||
zRef = 6
|
||||
inp0="$timeDir/x_0mCell_$items.xy"
|
||||
inp1="$timeDir/x_0mPatch_$items.xy"
|
||||
inp2="$timeDir/x_2500m_$items.xy"
|
||||
inp3="$timeDir/x_4000m_$items.xy"
|
||||
inp4="$timeDir/x_5000mCell_$items.xy"
|
||||
inp5="$timeDir/x_5000mPatch_$items.xy"
|
||||
|
||||
plot \
|
||||
"system/atm-HargreavesWright-2007/k-RH-Fig6b" \
|
||||
u 1:2 t "RH" w p ps 2 pt 6 lc rgb "#000000", \
|
||||
"system/atm-HargreavesWright-2007/k-HW-Fig6b-2500" \
|
||||
u 1:2 t "HW, x=2500m" w p ps 1 pt 5 lc rgb "#E69F00", \
|
||||
"system/atm-HargreavesWright-2007/k-HW-Fig6b-4000" \
|
||||
u 1:2 t "HW, x=4000m" w p ps 0.5 pt 4 lc rgb "#56B4E9", \
|
||||
inp0 u $seq:((\$1-$zMin)/zRef) t "OF, x=0m (Patch)" w l lw 2 lc rgb "#009E73", \
|
||||
inp1 u $seq:((\$1-$zMin)/zRef) t "OF, x=0m (Cell)" w l lw 2 lc rgb "#F0E440", \
|
||||
inp2 u $seq:((\$1-$zMin)/zRef) t "OF, x=2500m" w l lw 2 lc rgb "#0072B2", \
|
||||
inp3 u $seq:((\$1-$zMin)/zRef) t "OF, x=4000m" w l lw 2 lc rgb "#D55E00", \
|
||||
inp4 u $seq:((\$1-$zMin)/zRef) t "OF, x=5000m (Cell)" w l lw 2 lc rgb "#CC79A7", \
|
||||
inp5 u $seq:((\$1-$zMin)/zRef) t "OF, x=5000m (Patch)" w l lw 2 lc rgb "#440154"
|
||||
PLT_K
|
||||
}
|
||||
|
||||
|
||||
plotEpsilon() {
|
||||
timeDir=$1
|
||||
items=$2
|
||||
zMin=$3
|
||||
echo " Plotting the ground-normal turbulent kinetic"\
|
||||
"energy dissipation rate profile."
|
||||
|
||||
outName="plots/epsilon.png"
|
||||
gnuplot<<PLT_EPSILON
|
||||
set terminal pngcairo font "helvetica,20" size 1000, 800
|
||||
set xrange [0.001:10]
|
||||
set yrange [0:50]
|
||||
set grid
|
||||
set key top right
|
||||
set xlabel "epsilon [m^2 s^{-3}]"
|
||||
set ylabel "Non-dimensionalised height, z/z_{ref}"
|
||||
set offset .05, .05
|
||||
set logscale x
|
||||
set output "$outName"
|
||||
|
||||
zRef = 6
|
||||
inp0="$timeDir/x_0mCell_$items.xy"
|
||||
inp1="$timeDir/x_0mPatch_$items.xy"
|
||||
inp2="$timeDir/x_2500m_$items.xy"
|
||||
inp3="$timeDir/x_4000m_$items.xy"
|
||||
inp4="$timeDir/x_5000mCell_$items.xy"
|
||||
inp5="$timeDir/x_5000mPatch_$items.xy"
|
||||
|
||||
plot \
|
||||
"system/atm-HargreavesWright-2007/epsilon-HW-RH-Fig6c" \
|
||||
u 1:2 t "RH" w p ps 2 pt 6 lc rgb "#000000", \
|
||||
"system/atm-HargreavesWright-2007/epsilon-HW-RH-Fig6c" \
|
||||
u 1:2 t "HW, x=2500m" w p ps 1 pt 5 lc rgb "#E69F00", \
|
||||
"system/atm-HargreavesWright-2007/epsilon-HW-RH-Fig6c" \
|
||||
u 1:2 t "HW, x=4000m" w p ps 0.5 pt 4 lc rgb "#56B4E9", \
|
||||
inp0 u 2:((\$1-$zMin)/zRef) t "OF, x=0m (Patch)" w l lw 2 lc rgb "#009E73", \
|
||||
inp1 u 2:((\$1-$zMin)/zRef) t "OF, x=0m (Cell)" w l lw 2 lc rgb "#F0E440", \
|
||||
inp2 u 2:((\$1-$zMin)/zRef) t "OF, x=2500m" w l lw 2 lc rgb "#0072B2", \
|
||||
inp3 u 2:((\$1-$zMin)/zRef) t "OF, x=4000m" w l lw 2 lc rgb "#D55E00", \
|
||||
inp4 u 2:((\$1-$zMin)/zRef) t "OF, x=5000m (Cell)" w l lw 2 lc rgb "#CC79A7", \
|
||||
inp5 u 2:((\$1-$zMin)/zRef) t "OF, x=5000m (Patch)" w l lw 2 lc rgb "#440154"
|
||||
PLT_EPSILON
|
||||
}
|
||||
|
||||
|
||||
plotOmega() {
|
||||
timeDir=$1
|
||||
items=$2
|
||||
zMin=$3
|
||||
echo " Plotting the ground-normal specific dissipation rate profile."
|
||||
|
||||
outName="plots/omega.png"
|
||||
gnuplot<<PLT_OMEGA
|
||||
set terminal pngcairo font "helvetica,20" size 1000, 800
|
||||
set xrange [0.001:10]
|
||||
set yrange [0:50]
|
||||
set grid
|
||||
set key top right
|
||||
set xlabel "omega [s^{-1}]"
|
||||
set ylabel "Non-dimensionalised height, z/z_{ref}"
|
||||
set offset .05, .05
|
||||
set logscale x
|
||||
set output "$outName"
|
||||
|
||||
zRef = 6
|
||||
inp0="$timeDir/x_0mCell_$items.xy"
|
||||
inp1="$timeDir/x_0mPatch_$items.xy"
|
||||
inp2="$timeDir/x_2500m_$items.xy"
|
||||
inp3="$timeDir/x_4000m_$items.xy"
|
||||
inp4="$timeDir/x_5000mCell_$items.xy"
|
||||
inp5="$timeDir/x_5000mPatch_$items.xy"
|
||||
|
||||
plot \
|
||||
inp0 u 4:((\$1-$zMin)/zRef) t "OF, x=0m (Patch)" w l lw 2 lc rgb "#009E73", \
|
||||
inp1 u 4:((\$1-$zMin)/zRef) t "OF, x=0m (Cell)" w l lw 2 lc rgb "#F0E440", \
|
||||
inp2 u 4:((\$1-$zMin)/zRef) t "OF, x=2500m" w l lw 2 lc rgb "#0072B2", \
|
||||
inp3 u 4:((\$1-$zMin)/zRef) t "OF, x=4000m" w l lw 2 lc rgb "#D55E00", \
|
||||
inp4 u 4:((\$1-$zMin)/zRef) t "OF, x=5000m (Cell)" w l lw 2 lc rgb "#CC79A7", \
|
||||
inp5 u 4:((\$1-$zMin)/zRef) t "OF, x=5000m (Patch)" w l lw 2 lc rgb "#440154"
|
||||
PLT_OMEGA
|
||||
}
|
||||
|
||||
|
||||
plotMut() {
|
||||
timeDir=$1
|
||||
items=$2
|
||||
seq=$3
|
||||
zMin=$4
|
||||
echo " Plotting the ground-normal turbulent viscosity profile."
|
||||
|
||||
outName="plots/mut.png"
|
||||
gnuplot<<PLT_MUT
|
||||
set terminal pngcairo font "helvetica,20" size 1000, 800
|
||||
set xrange [0:120]
|
||||
set yrange [0:50]
|
||||
set grid
|
||||
set key bottom right
|
||||
set xlabel "mu_t [Pa.s]"
|
||||
set ylabel "Non-dimensionalised height, z/z_{ref}"
|
||||
set offset .05, .05
|
||||
set output "$outName"
|
||||
|
||||
zRef = 6
|
||||
inp0="$timeDir/x_0mCell_$items.xy"
|
||||
inp1="$timeDir/x_0mPatch_$items.xy"
|
||||
inp2="$timeDir/x_2500m_$items.xy"
|
||||
inp3="$timeDir/x_4000m_$items.xy"
|
||||
inp4="$timeDir/x_5000mCell_$items.xy"
|
||||
inp5="$timeDir/x_5000mPatch_$items.xy"
|
||||
|
||||
plot \
|
||||
"system/atm-HargreavesWright-2007/mut-RH-Fig6d" \
|
||||
u 1:2 t "RH" w p ps 2 pt 6 lc rgb "#000000", \
|
||||
"system/atm-HargreavesWright-2007/mut-HW-Fig6d-2500" \
|
||||
u 1:2 t "HW, x=2500m" w p ps 1 pt 5 lc rgb "#E69F00", \
|
||||
"system/atm-HargreavesWright-2007/mut-HW-Fig6d-4000" \
|
||||
u 1:2 t "HW, x=4000m" w p ps 0.5 pt 4 lc rgb "#56B4E9", \
|
||||
inp0 u $seq:((\$1-$zMin)/zRef) t "OF, x=0m (Patch)" w l lw 2 lc rgb "#009E73", \
|
||||
inp1 u $seq:((\$1-$zMin)/zRef) t "OF, x=0m (Cell)" w l lw 2 lc rgb "#F0E440", \
|
||||
inp2 u $seq:((\$1-$zMin)/zRef) t "OF, x=2500m" w l lw 2 lc rgb "#0072B2", \
|
||||
inp3 u $seq:((\$1-$zMin)/zRef) t "OF, x=4000m" w l lw 2 lc rgb "#D55E00", \
|
||||
inp4 u $seq:((\$1-$zMin)/zRef) t "OF, x=5000m (Cell)" w l lw 2 lc rgb "#CC79A7", \
|
||||
inp5 u $seq:((\$1-$zMin)/zRef) t "OF, x=5000m (Patch)" w l lw 2 lc rgb "#440154"
|
||||
PLT_MUT
|
||||
}
|
||||
|
||||
|
||||
#------------------------------------------------------------------------------
|
||||
|
||||
# Require gnuplot
|
||||
command -v gnuplot >/dev/null || {
|
||||
echo "gnuplot not found - skipping graph creation" 1>&2
|
||||
exit 1
|
||||
}
|
||||
|
||||
# The latestTime in postProcessing/samples
|
||||
timeDir=$(foamListTimes -case postProcessing/samples -latestTime 2>/dev/null)
|
||||
[ -n "$timeDir" ] || {
|
||||
echo "No postProcessing/samples found - skipping graph creation" 1>&2
|
||||
exit 2
|
||||
}
|
||||
timeDir="postProcessing/samples/$timeDir"
|
||||
zMin=0
|
||||
mkdir -p plots
|
||||
|
||||
|
||||
# Postprocess flow speed
|
||||
plotUxUpstream $timeDir $zMin
|
||||
plotUxMid $timeDir $zMin
|
||||
plotUxDownstream $timeDir $zMin
|
||||
|
||||
# Postprocess turbulence quantities
|
||||
if [ $baseEpsilonOrOmega == "epsilon" ]
|
||||
then
|
||||
items="epsilon_k_nut"
|
||||
|
||||
plotEpsilon $timeDir $items $zMin
|
||||
plotK $timeDir $items 3 $zMin
|
||||
plotMut $timeDir $items 4 $zMin
|
||||
|
||||
elif [ $baseEpsilonOrOmega == "omega" ]
|
||||
then
|
||||
items="k_nut_omega"
|
||||
|
||||
plotK $timeDir $items 2 $zMin
|
||||
plotMut $timeDir $items 3 $zMin
|
||||
plotOmega $timeDir $items $zMin
|
||||
|
||||
else
|
||||
echo "Chosen turbulence model is neither epsilon nor omega based." 1>&2
|
||||
exit 2
|
||||
fi
|
||||
|
||||
|
||||
#------------------------------------------------------------------------------
|
||||
@ -5,8 +5,10 @@ cd "${0%/*}" || exit # Run from this directory
|
||||
|
||||
cleanCase0
|
||||
|
||||
rm -rf 0.orig
|
||||
rm -rf system
|
||||
rm -rf constant
|
||||
rm -rf results
|
||||
rm -rf plots
|
||||
rm -f constant/turbulenceProperties
|
||||
rm -rf system/atm-HargreavesWright-2007
|
||||
|
||||
#------------------------------------------------------------------------------
|
||||
@ -0,0 +1,120 @@
|
||||
#!/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
|
||||
|
||||
# operand setups
|
||||
setups="
|
||||
kEpsilon
|
||||
kOmegaSST
|
||||
"
|
||||
|
||||
# flag to enable computations in parallel mode
|
||||
parallel=true
|
||||
|
||||
|
||||
#------------------------------------------------------------------------------
|
||||
#######################################
|
||||
# Collect results into a given path
|
||||
# and clean the case for the next run
|
||||
# Arguments:
|
||||
# $1 = Path to move results
|
||||
# Outputs:
|
||||
# Writes info to stdout
|
||||
#######################################
|
||||
collect() {
|
||||
|
||||
[ $# -eq 0 ] && { echo "Usage: $0 dir-model"; exit 1; }
|
||||
|
||||
collection="$1"
|
||||
|
||||
dirResult=results/"$collection"
|
||||
dirSettings="$dirResult"/settings
|
||||
|
||||
if [ ! -d "$dirResult" ]
|
||||
then
|
||||
|
||||
echo " # Collecting results and settings into $dirResult"
|
||||
|
||||
mkdir -p "$dirResult"
|
||||
mkdir -p "$dirSettings"
|
||||
|
||||
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"
|
||||
|
||||
cleanTimeDirectories
|
||||
cleanPostProcessing
|
||||
|
||||
else
|
||||
|
||||
echo " # Directory $dirResult already exists"
|
||||
echo " # Skipping the computation"
|
||||
|
||||
fi
|
||||
}
|
||||
|
||||
|
||||
#------------------------------------------------------------------------------
|
||||
|
||||
for setup in $setups
|
||||
do
|
||||
|
||||
echo ""
|
||||
echo "# Computations for the setup: $setup"
|
||||
echo ""
|
||||
|
||||
dirSetup="setups.orig/$setup"
|
||||
|
||||
if [ ! -d "$dirSetup" ]
|
||||
then
|
||||
echo "Setup directory: $dirSetup" \
|
||||
"could not be found - skipping execution" 1>&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
cp -rfL "$dirSetup/0.orig" .
|
||||
cp -rfL "$dirSetup/constant" .
|
||||
cp -rfL "$dirSetup/system" .
|
||||
cp -rf 0.orig/ 0/
|
||||
|
||||
if [ ! -d constant/polyMesh ]
|
||||
then
|
||||
|
||||
runApplication blockMesh
|
||||
|
||||
runApplication renumberMesh -overwrite -constant
|
||||
|
||||
runApplication checkMesh -allTopology -allGeometry -constant
|
||||
|
||||
fi
|
||||
|
||||
if [ "$parallel" = true ]
|
||||
then
|
||||
|
||||
runApplication decomposePar
|
||||
|
||||
runParallel $(getApplication)
|
||||
|
||||
runApplication reconstructPar
|
||||
|
||||
else
|
||||
|
||||
runApplication $(getApplication)
|
||||
|
||||
fi
|
||||
|
||||
collect "$setup"
|
||||
|
||||
done
|
||||
|
||||
|
||||
#------------------------------------------------------------------------------
|
||||
@ -0,0 +1,415 @@
|
||||
#!/bin/sh
|
||||
cd "${0%/*}" || exit # Run from this directory
|
||||
. ${WM_PROJECT_DIR:?}/bin/tools/RunFunctions # Tutorial run functions
|
||||
#------------------------------------------------------------------------------
|
||||
|
||||
# settings
|
||||
|
||||
# operand setups
|
||||
setups="
|
||||
kEpsilon
|
||||
kOmegaSST
|
||||
"
|
||||
|
||||
# operand minimum z height
|
||||
zMin=0
|
||||
|
||||
# Note: Benchmark data is available for the standard k-epsilon model from:
|
||||
# Hargreaves, D. M., & Wright, N. G. (2007).
|
||||
# On the use of the k–ε model in commercial CFD software
|
||||
# to model the neutral atmospheric boundary layer.
|
||||
# Journal of wind engineering and
|
||||
# industrial aerodynamics, 95(5), 355-369.
|
||||
# DOI:10.1016/j.jweia.2006.08.002
|
||||
# Figure 6.
|
||||
#------------------------------------------------------------------------------
|
||||
|
||||
plot_ux_vs_znorm_upstream() {
|
||||
|
||||
echo " # Plots the ground-normal flow speed profile (upstream)"
|
||||
|
||||
endTime="$1"
|
||||
zMin="$2"
|
||||
|
||||
benchmarkFile="$FOAM_TUTORIALS/resources/dataset/atm-HargreavesWright-2007/Ux-HW-RH-Fig6a"
|
||||
sampleFile="results/$setup/postProcessing/samples_u/$endTime"
|
||||
image="plots/$setup/ux_vs_znorm_upstream.png"
|
||||
|
||||
gnuplot<<PLT_UX_UPSTREAM
|
||||
set terminal pngcairo font "helvetica,20" size 1000, 800
|
||||
set xrange [4:18]
|
||||
set yrange [0:50]
|
||||
set grid
|
||||
set key top left
|
||||
set xlabel "U_x [m s^{-1}]"
|
||||
set ylabel "Non-dimensionalised height, z/z_{ref}"
|
||||
set offset .05, .05
|
||||
set output "$image"
|
||||
|
||||
# Benchmark
|
||||
benchmark="$benchmarkFile"
|
||||
zRef=6
|
||||
|
||||
# OpenFOAM
|
||||
samplesCell="$sampleFile/x_0mCell_U.xy"
|
||||
samplesPatch="$sampleFile/x_0mPatch_U.xy"
|
||||
zMin="$zMin"
|
||||
|
||||
plot \
|
||||
benchmark u 1:2 t "Richards-Hoxey" w p ps 2 pt 6 lc rgb "#000000", \
|
||||
benchmark u 1:2 t "Hargreaves-Wright, x=2500m" w p ps 1 pt 5 lc rgb "#E69F00", \
|
||||
benchmark u 1:2 t "Hargreaves-Wright, x=4000m" w p ps 0.5 pt 4 lc rgb "#56B4E9", \
|
||||
samplesCell u 2:((\$1-$zMin)/zRef) t "OpenFOAM, x=0m (Patch)" w l lw 2 lc rgb "#009E73", \
|
||||
samplesPatch u 2:((\$1-$zMin)/zRef) t "OpenFOAM, x=0m (Cell)" w l lw 2 lc rgb "#F0E440"
|
||||
PLT_UX_UPSTREAM
|
||||
}
|
||||
|
||||
|
||||
plot_ux_vs_znorm_middle() {
|
||||
|
||||
echo " # Plots the ground-normal flow speed profile (mid-range)"
|
||||
|
||||
endTime="$1"
|
||||
zMin="$2"
|
||||
|
||||
benchmarkFile="$FOAM_TUTORIALS/resources/dataset/atm-HargreavesWright-2007/Ux-HW-RH-Fig6a"
|
||||
sampleFile="results/$setup/postProcessing/samples_u/$endTime"
|
||||
image="plots/$setup/ux_vs_znorm_middle.png"
|
||||
|
||||
gnuplot<<PLT_UX_MID
|
||||
set terminal pngcairo font "helvetica,20" size 1000, 800
|
||||
set xrange [4:18]
|
||||
set yrange [0:50]
|
||||
set grid
|
||||
set key top left
|
||||
set xlabel "U_x [m s^{-1}]"
|
||||
set ylabel "Non-dimensionalised height, z/z_{ref}"
|
||||
set offset .05, .05
|
||||
set output "$image"
|
||||
|
||||
# Benchmark
|
||||
benchmark="$benchmarkFile"
|
||||
zRef=6
|
||||
|
||||
# OpenFOAM
|
||||
samples0="$sampleFile/x_2500m_U.xy"
|
||||
samples1="$sampleFile/x_4000m_U.xy"
|
||||
zMin="$zMin"
|
||||
|
||||
plot \
|
||||
benchmark u 1:2 t "Richards-Hoxey" w p ps 2 pt 6 lc rgb "#000000", \
|
||||
benchmark u 1:2 t "Hargreaves-Wright, x=2500m" w p ps 1 pt 5 lc rgb "#E69F00", \
|
||||
benchmark u 1:2 t "Hargreaves-Wright, x=4000m" w p ps 0.5 pt 4 lc rgb "#56B4E9", \
|
||||
samples0 u 2:((\$1-$zMin)/zRef) t "OpenFOAM, x=2500m" w l lw 2 lc rgb "#0072B2", \
|
||||
samples1 u 2:((\$1-$zMin)/zRef) t "OpenFOAM, x=4000m" w l lw 2 lc rgb "#D55E00"
|
||||
PLT_UX_MID
|
||||
}
|
||||
|
||||
|
||||
plot_ux_vs_znorm_downstream() {
|
||||
|
||||
echo " # Plots the ground-normal flow speed profile (downstream)"
|
||||
|
||||
endTime="$1"
|
||||
zMin="$2"
|
||||
|
||||
benchmarkFile="$FOAM_TUTORIALS/resources/dataset/atm-HargreavesWright-2007/Ux-HW-RH-Fig6a"
|
||||
sampleFile="results/$setup/postProcessing/samples_u/$endTime"
|
||||
image="plots/$setup/ux_vs_znorm_downstream.png"
|
||||
|
||||
gnuplot<<PLT_UX_DOWNSTREAM
|
||||
set terminal pngcairo font "helvetica,20" size 1000, 800
|
||||
set xrange [4:18]
|
||||
set yrange [0:50]
|
||||
set grid
|
||||
set key top left
|
||||
set xlabel "U_x [m s^{-1}]"
|
||||
set ylabel "Non-dimensionalised height, z/z_{ref}"
|
||||
set offset .05, .05
|
||||
set output "$image"
|
||||
|
||||
# Benchmark
|
||||
benchmark="$benchmarkFile"
|
||||
zRef=6
|
||||
|
||||
# OpenFOAM
|
||||
samplesCell="$sampleFile/x_5000mCell_U.xy"
|
||||
samplesPatch="$sampleFile/x_5000mPatch_U.xy"
|
||||
zMin="$zMin"
|
||||
|
||||
plot \
|
||||
benchmark u 1:2 t "Richards-Hoxey" w p ps 2 pt 6 lc rgb "#000000", \
|
||||
benchmark u 1:2 t "Hargreaves-Wright, x=2500m" w p ps 1 pt 5 lc rgb "#E69F00", \
|
||||
benchmark u 1:2 t "Hargreaves-Wright, x=4000m" w p ps 0.5 pt 4 lc rgb "#56B4E9", \
|
||||
samplesCell u 2:((\$1-$zMin)/zRef) t "OpenFOAM, x=5000m (Cell)" w l lw 2 lc rgb "#CC79A7", \
|
||||
samplesPatch u 2:((\$1-$zMin)/zRef) t "OpenFOAM, x=5000m (Patch)" w l lw 2 lc rgb "#440154"
|
||||
PLT_UX_DOWNSTREAM
|
||||
}
|
||||
|
||||
|
||||
plot_k_vs_znorm() {
|
||||
|
||||
echo " # Plots the ground-normal turbulent kinetic energy profile"
|
||||
|
||||
endTime="$1"
|
||||
zMin="$2"
|
||||
|
||||
benchmarkFile="$FOAM_TUTORIALS/resources/dataset/atm-HargreavesWright-2007"
|
||||
sampleFile="results/$setup/postProcessing/samples_k/$endTime"
|
||||
image="plots/$setup/k_vs_znorm.png"
|
||||
|
||||
gnuplot<<PLT_K
|
||||
set terminal pngcairo font "helvetica,20" size 1000, 800
|
||||
set xrange [1:2]
|
||||
set yrange [0:50]
|
||||
set grid
|
||||
set key top right
|
||||
set xlabel "k [m^2 s^{-2}]"
|
||||
set ylabel "Non-dimensionalised height, z/z_{ref}"
|
||||
set offset .05, .05
|
||||
set output "$image"
|
||||
|
||||
# Benchmark
|
||||
benchmark0="$benchmarkFile/k-RH-Fig6b"
|
||||
benchmark1="$benchmarkFile/k-HW-Fig6b-2500"
|
||||
benchmark2="$benchmarkFile/k-HW-Fig6b-4000"
|
||||
zRef=6
|
||||
|
||||
# OpenFOAM
|
||||
samples0="$sampleFile/x_0mCell_k.xy"
|
||||
samples1="$sampleFile/x_0mPatch_k.xy"
|
||||
samples2="$sampleFile/x_2500m_k.xy"
|
||||
samples3="$sampleFile/x_4000m_k.xy"
|
||||
samples4="$sampleFile/x_5000mCell_k.xy"
|
||||
samples5="$sampleFile/x_5000mPatch_k.xy"
|
||||
|
||||
plot \
|
||||
benchmark0 u 1:2 t "Richards-Hoxey" w p ps 2 pt 6 lc rgb "#000000", \
|
||||
benchmark1 u 1:2 t "Hargreaves-Wright, x=2500m" w p ps 1 pt 5 lc rgb "#E69F00", \
|
||||
benchmark2 u 1:2 t "Hargreaves-Wright, x=4000m" w p ps 0.5 pt 4 lc rgb "#56B4E9", \
|
||||
samples0 u 2:((\$1-$zMin)/zRef) t "OpenFOAM, x=0m (Patch)" w l lw 2 lc rgb "#009E73", \
|
||||
samples1 u 2:((\$1-$zMin)/zRef) t "OpenFOAM, x=0m (Cell)" w l lw 2 lc rgb "#F0E440", \
|
||||
samples2 u 2:((\$1-$zMin)/zRef) t "OpenFOAM, x=2500m" w l lw 2 lc rgb "#0072B2", \
|
||||
samples3 u 2:((\$1-$zMin)/zRef) t "OpenFOAM, x=4000m" w l lw 2 lc rgb "#D55E00", \
|
||||
samples4 u 2:((\$1-$zMin)/zRef) t "OpenFOAM, x=5000m (Cell)" w l lw 2 lc rgb "#CC79A7", \
|
||||
samples5 u 2:((\$1-$zMin)/zRef) t "OpenFOAM, x=5000m (Patch)" w l lw 2 lc rgb "#440154"
|
||||
PLT_K
|
||||
}
|
||||
|
||||
|
||||
plot_epsilon_vs_znorm() {
|
||||
|
||||
echo " # Plots the ground-normal turbulent kinetic"\
|
||||
"energy dissipation rate profile"
|
||||
|
||||
endTime="$1"
|
||||
zMin="$2"
|
||||
|
||||
benchmarkFile="$FOAM_TUTORIALS/resources/dataset/atm-HargreavesWright-2007/epsilon-HW-RH-Fig6c"
|
||||
sampleFile="results/$setup/postProcessing/samples_epsilon/$endTime"
|
||||
image="plots/$setup/epsilon_vs_znorm.png"
|
||||
|
||||
gnuplot<<PLT_EPSILON
|
||||
set terminal pngcairo font "helvetica,20" size 1000, 800
|
||||
set xrange [0.001:10]
|
||||
set yrange [0:50]
|
||||
set grid
|
||||
set key top right
|
||||
set xlabel "{/Symbol e} [m^2 s^{-3}]"
|
||||
set ylabel "Non-dimensionalised height, z/z_{ref}"
|
||||
set offset .05, .05
|
||||
set logscale x
|
||||
set output "$image"
|
||||
|
||||
# Benchmark
|
||||
benchmark="$benchmarkFile"
|
||||
zRef=6
|
||||
|
||||
# OpenFOAM
|
||||
samples0="$sampleFile/x_0mCell_epsilon.xy"
|
||||
samples1="$sampleFile/x_0mPatch_epsilon.xy"
|
||||
samples2="$sampleFile/x_2500m_epsilon.xy"
|
||||
samples3="$sampleFile/x_4000m_epsilon.xy"
|
||||
samples4="$sampleFile/x_5000mCell_epsilon.xy"
|
||||
samples5="$sampleFile/x_5000mPatch_epsilon.xy"
|
||||
|
||||
plot \
|
||||
benchmark u 1:2 t "Richards-Hoxey" w p ps 2 pt 6 lc rgb "#000000", \
|
||||
benchmark u 1:2 t "Hargreaves-Wright, x=2500m" w p ps 1 pt 5 lc rgb "#E69F00", \
|
||||
benchmark u 1:2 t "Hargreaves-Wright, x=4000m" w p ps 0.5 pt 4 lc rgb "#56B4E9", \
|
||||
samples0 u 2:((\$1-$zMin)/zRef) t "OpenFOAM, x=0m (Patch)" w l lw 2 lc rgb "#009E73", \
|
||||
samples1 u 2:((\$1-$zMin)/zRef) t "OpenFOAM, x=0m (Cell)" w l lw 2 lc rgb "#F0E440", \
|
||||
samples2 u 2:((\$1-$zMin)/zRef) t "OpenFOAM, x=2500m" w l lw 2 lc rgb "#0072B2", \
|
||||
samples3 u 2:((\$1-$zMin)/zRef) t "OpenFOAM, x=4000m" w l lw 2 lc rgb "#D55E00", \
|
||||
samples4 u 2:((\$1-$zMin)/zRef) t "OpenFOAM, x=5000m (Cell)" w l lw 2 lc rgb "#CC79A7", \
|
||||
samples5 u 2:((\$1-$zMin)/zRef) t "OpenFOAM, x=5000m (Patch)" w l lw 2 lc rgb "#440154"
|
||||
PLT_EPSILON
|
||||
}
|
||||
|
||||
|
||||
plot_omega_vs_znorm() {
|
||||
|
||||
echo " # Plots the ground-normal specific dissipation rate profile"
|
||||
|
||||
endTime="$1"
|
||||
zMin="$2"
|
||||
|
||||
# benchmarkFile=N/A
|
||||
sampleFile="results/$setup/postProcessing/samples_omega/$endTime"
|
||||
image="plots/$setup/omega_vs_znorm.png"
|
||||
|
||||
gnuplot<<PLT_OMEGA
|
||||
set terminal pngcairo font "helvetica,20" size 1000, 800
|
||||
set xrange [0.001:10]
|
||||
set yrange [0:50]
|
||||
set grid
|
||||
set key top right
|
||||
set xlabel "{/Symbol w} [s^{-1}]"
|
||||
set ylabel "Non-dimensionalised height, z/z_{ref}"
|
||||
set offset .05, .05
|
||||
set logscale x
|
||||
set output "$image"
|
||||
|
||||
# Benchmark
|
||||
zRef=6
|
||||
|
||||
# OpenFOAM
|
||||
samples0="$sampleFile/x_0mCell_omega.xy"
|
||||
samples1="$sampleFile/x_0mPatch_omega.xy"
|
||||
samples2="$sampleFile/x_2500m_omega.xy"
|
||||
samples3="$sampleFile/x_4000m_omega.xy"
|
||||
samples4="$sampleFile/x_5000mCell_omega.xy"
|
||||
samples5="$sampleFile/x_5000mPatch_omega.xy"
|
||||
|
||||
plot \
|
||||
samples0 u 2:((\$1-$zMin)/zRef) t "OpenFOAM, x=0m (Patch)" w l lw 2 lc rgb "#009E73", \
|
||||
samples1 u 2:((\$1-$zMin)/zRef) t "OpenFOAM, x=0m (Cell)" w l lw 2 lc rgb "#F0E440", \
|
||||
samples2 u 2:((\$1-$zMin)/zRef) t "OpenFOAM, x=2500m" w l lw 2 lc rgb "#0072B2", \
|
||||
samples3 u 2:((\$1-$zMin)/zRef) t "OpenFOAM, x=4000m" w l lw 2 lc rgb "#D55E00", \
|
||||
samples4 u 2:((\$1-$zMin)/zRef) t "OpenFOAM, x=5000m (Cell)" w l lw 2 lc rgb "#CC79A7", \
|
||||
samples5 u 2:((\$1-$zMin)/zRef) t "OpenFOAM, x=5000m (Patch)" w l lw 2 lc rgb "#440154"
|
||||
PLT_OMEGA
|
||||
}
|
||||
|
||||
|
||||
plot_nut_vs_znorm() {
|
||||
|
||||
echo " # Plots the ground-normal turbulent viscosity profile"
|
||||
|
||||
endTime="$1"
|
||||
zMin="$2"
|
||||
|
||||
benchmarkFile="$FOAM_TUTORIALS/resources/dataset/atm-HargreavesWright-2007/"
|
||||
sampleFile="results/$setup/postProcessing/samples_nut/$endTime"
|
||||
image="plots/$setup/nut_vs_znorm.png"
|
||||
|
||||
gnuplot<<PLT_NUT
|
||||
set terminal pngcairo font "helvetica,20" size 1000, 800
|
||||
set xrange [0:120]
|
||||
set yrange [0:50]
|
||||
set grid
|
||||
set key bottom right
|
||||
set xlabel "{/Symbol m}_t [Pa.s]"
|
||||
set ylabel "Non-dimensionalised height, z/z_{ref}"
|
||||
set offset .05, .05
|
||||
set output "$image"
|
||||
|
||||
# Benchmark
|
||||
benchmark0="$benchmarkFile/mut-RH-Fig6d"
|
||||
benchmark1="$benchmarkFile/mut-HW-Fig6d-2500"
|
||||
benchmark2="$benchmarkFile/mut-HW-Fig6d-4000"
|
||||
zRef=6
|
||||
|
||||
# OpenFOAM
|
||||
samples0="$sampleFile/x_0mCell_nut.xy"
|
||||
samples1="$sampleFile/x_0mPatch_nut.xy"
|
||||
samples2="$sampleFile/x_2500m_nut.xy"
|
||||
samples3="$sampleFile/x_4000m_nut.xy"
|
||||
samples4="$sampleFile/x_5000mCell_nut.xy"
|
||||
samples5="$sampleFile/x_5000mPatch_nut.xy"
|
||||
|
||||
plot \
|
||||
benchmark0 u 1:2 t "Richards-Hoxey" w p ps 2 pt 6 lc rgb "#000000", \
|
||||
benchmark1 u 1:2 t "Hargreaves-Wright, x=2500m" w p ps 1 pt 5 lc rgb "#E69F00", \
|
||||
benchmark2 u 1:2 t "Hargreaves-Wright, x=4000m" w p ps 0.5 pt 4 lc rgb "#56B4E9", \
|
||||
samples0 u 2:((\$1-$zMin)/zRef) t "OpenFOAM, x=0m (Patch)" w l lw 2 lc rgb "#009E73", \
|
||||
samples1 u 2:((\$1-$zMin)/zRef) t "OpenFOAM, x=0m (Cell)" w l lw 2 lc rgb "#F0E440", \
|
||||
samples2 u 2:((\$1-$zMin)/zRef) t "OpenFOAM, x=2500m" w l lw 2 lc rgb "#0072B2", \
|
||||
samples3 u 2:((\$1-$zMin)/zRef) t "OpenFOAM, x=4000m" w l lw 2 lc rgb "#D55E00", \
|
||||
samples4 u 2:((\$1-$zMin)/zRef) t "OpenFOAM, x=5000m (Cell)" w l lw 2 lc rgb "#CC79A7", \
|
||||
samples5 u 2:((\$1-$zMin)/zRef) t "OpenFOAM, x=5000m (Patch)" w l lw 2 lc rgb "#440154"
|
||||
PLT_NUT
|
||||
}
|
||||
|
||||
|
||||
#------------------------------------------------------------------------------
|
||||
|
||||
# Requires gnuplot
|
||||
command -v gnuplot >/dev/null || {
|
||||
echo "gnuplot 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"
|
||||
|
||||
endTime=$( \
|
||||
foamDictionary results/$setup/settings/controlDict \
|
||||
-disableFunctionEntries -entry endTime -value \
|
||||
)
|
||||
|
||||
|
||||
plot_ux_vs_znorm_upstream "$endTime" "$zMin"
|
||||
|
||||
plot_ux_vs_znorm_middle "$endTime" "$zMin"
|
||||
|
||||
plot_ux_vs_znorm_downstream "$endTime" "$zMin"
|
||||
|
||||
if [ -d "results/$setup/postProcessing/samples_k" ]
|
||||
then
|
||||
|
||||
plot_k_vs_znorm "$endTime" "$zMin"
|
||||
|
||||
fi
|
||||
|
||||
if [ -d "results/$setup/postProcessing/samples_epsilon" ]
|
||||
then
|
||||
|
||||
plot_epsilon_vs_znorm "$endTime" "$zMin"
|
||||
|
||||
fi
|
||||
|
||||
if [ -d "results/$setup/postProcessing/samples_omega" ]
|
||||
then
|
||||
|
||||
plot_omega_vs_znorm "$endTime" "$zMin"
|
||||
|
||||
fi
|
||||
|
||||
if [ -d "results/$setup/postProcessing/samples_nut" ]
|
||||
then
|
||||
|
||||
plot_nut_vs_znorm "$endTime" "$zMin"
|
||||
|
||||
fi
|
||||
|
||||
done
|
||||
|
||||
|
||||
#------------------------------------------------------------------------------
|
||||
@ -49,7 +49,7 @@ runTimeModifiable yes;
|
||||
|
||||
functions
|
||||
{
|
||||
#include "sampleDict"
|
||||
#include "sampleLines"
|
||||
#include "sampleIso"
|
||||
#include "samplePlanes"
|
||||
|
||||
@ -1,31 +1,17 @@
|
||||
/*--------------------------------*- C++ -*----------------------------------*\
|
||||
| ========= | |
|
||||
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
|
||||
| \\ / O peration | Version: v2012 |
|
||||
| \\ / A nd | Website: www.openfoam.com |
|
||||
| \\/ M anipulation | |
|
||||
\*---------------------------------------------------------------------------*/
|
||||
FoamFile
|
||||
{
|
||||
version 2.0;
|
||||
format ascii;
|
||||
class dictionary;
|
||||
object sampleDict;
|
||||
}
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
// -*- C++ -*-
|
||||
|
||||
// The locations of the sample profiles correspond to:
|
||||
// Hargreaves-Wright (2007), Fig.6
|
||||
// DOI:10.1016/j.jweia.2006.08.002
|
||||
|
||||
samples
|
||||
_sampler
|
||||
{
|
||||
type sets;
|
||||
libs (sampling);
|
||||
setFormat raw;
|
||||
interpolationScheme cell;
|
||||
fields (U k epsilon nut omega);
|
||||
writeControl writeTime;
|
||||
enabled false;
|
||||
|
||||
sets
|
||||
(
|
||||
@ -74,5 +60,40 @@ samples
|
||||
);
|
||||
}
|
||||
|
||||
samples_u
|
||||
{
|
||||
${_sampler}
|
||||
fields (U);
|
||||
enabled true;
|
||||
}
|
||||
|
||||
samples_k
|
||||
{
|
||||
${_sampler}
|
||||
fields (k);
|
||||
enabled true;
|
||||
}
|
||||
|
||||
samples_epsilon
|
||||
{
|
||||
${_sampler}
|
||||
fields (epsilon);
|
||||
enabled true;
|
||||
}
|
||||
|
||||
samples_omega
|
||||
{
|
||||
${_sampler}
|
||||
fields (omega);
|
||||
enabled true;
|
||||
}
|
||||
|
||||
samples_nut
|
||||
{
|
||||
${_sampler}
|
||||
fields (nut);
|
||||
enabled true;
|
||||
}
|
||||
|
||||
|
||||
// *********************************************************************** //
|
||||
@ -0,0 +1 @@
|
||||
../../common/0.orig/U
|
||||
@ -0,0 +1 @@
|
||||
../../common/0.orig/include
|
||||
@ -0,0 +1 @@
|
||||
../../common/0.orig/k
|
||||
@ -0,0 +1 @@
|
||||
../../common/0.orig/nut
|
||||
@ -0,0 +1 @@
|
||||
../../common/0.orig/p
|
||||
@ -0,0 +1 @@
|
||||
../../common/constant/transportProperties
|
||||
@ -18,11 +18,13 @@ simulationType RAS;
|
||||
|
||||
RAS
|
||||
{
|
||||
RASModel RAS_MODEL;
|
||||
RASModel kEpsilon;
|
||||
|
||||
turbulence on;
|
||||
|
||||
printCoeffs on;
|
||||
|
||||
RAS_MODELCoeffs // Valid only for epsilon-based models
|
||||
kEpsilonCoeffs // Valid only for epsilon-based models
|
||||
{
|
||||
Cmu 0.09;
|
||||
C1 1.44;
|
||||
@ -0,0 +1 @@
|
||||
../common/system/
|
||||
@ -0,0 +1 @@
|
||||
../../common/0.orig/U
|
||||
@ -0,0 +1 @@
|
||||
../../common/0.orig/include
|
||||
@ -0,0 +1 @@
|
||||
../../common/0.orig/k
|
||||
@ -0,0 +1 @@
|
||||
../../common/0.orig/nut
|
||||
@ -0,0 +1 @@
|
||||
../../common/0.orig/p
|
||||
@ -0,0 +1 @@
|
||||
../../common/constant/transportProperties
|
||||
@ -0,0 +1,29 @@
|
||||
/*--------------------------------*- C++ -*----------------------------------*\
|
||||
| ========= | |
|
||||
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
|
||||
| \\ / O peration | Version: v2012 |
|
||||
| \\ / A nd | Website: www.openfoam.com |
|
||||
| \\/ M anipulation | |
|
||||
\*---------------------------------------------------------------------------*/
|
||||
FoamFile
|
||||
{
|
||||
version 2.0;
|
||||
format ascii;
|
||||
class dictionary;
|
||||
object turbulenceProperties;
|
||||
}
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
simulationType RAS;
|
||||
|
||||
RAS
|
||||
{
|
||||
RASModel kOmegaSST;
|
||||
|
||||
turbulence on;
|
||||
|
||||
printCoeffs on;
|
||||
}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -0,0 +1 @@
|
||||
../common/system/
|
||||
@ -3,8 +3,8 @@ cd "${0%/*}" || exit # Run from this directory
|
||||
. ${WM_PROJECT_DIR:?}/bin/tools/RunFunctions # Tutorial run functions
|
||||
#------------------------------------------------------------------------------
|
||||
|
||||
(cd precursor && foamRunTutorials)
|
||||
(cd precursor && ./Allrun)
|
||||
|
||||
(cd successor && foamRunTutorials)
|
||||
(cd successor && ./Allrun)
|
||||
|
||||
#------------------------------------------------------------------------------
|
||||
@ -5,9 +5,10 @@ cd "${0%/*}" || exit # Run from this directory
|
||||
|
||||
cleanCase0
|
||||
|
||||
rm -f constant/fvOptions
|
||||
rm -f constant/turbulenceProperties
|
||||
rm -rf system/atm-Koblitz-2013
|
||||
rm -rf 0.orig
|
||||
rm -rf system
|
||||
rm -rf constant
|
||||
rm -rf results
|
||||
rm -rf plots
|
||||
|
||||
#------------------------------------------------------------------------------
|
||||
@ -4,33 +4,123 @@ cd "${0%/*}" || exit # Run from this directory
|
||||
. ${WM_PROJECT_DIR:?}/bin/tools/CleanFunctions # Tutorial clean functions
|
||||
#------------------------------------------------------------------------------
|
||||
|
||||
./Allrun.pre
|
||||
# settings
|
||||
|
||||
# Settings
|
||||
RASmodel="kEpsilon" # "kOmegaSST"
|
||||
stability="neutral"
|
||||
Lmax="41.8"
|
||||
qPlant="0.0"
|
||||
# operand setups (only neutral stability)
|
||||
setups="
|
||||
kEpsilon
|
||||
kOmegaSST
|
||||
"
|
||||
|
||||
echo " # Computations for the atmopsheric stability = $stability:"
|
||||
echo " ## Lmax = $Lmax [m], qPlant = $qPlant [-]"
|
||||
# flag to enable computations in parallel mode
|
||||
parallel=true
|
||||
|
||||
|
||||
#------------------------------------------------------------------------------
|
||||
#######################################
|
||||
# Collect results and mesh into a given path
|
||||
# and clean the case for the next run
|
||||
# Arguments:
|
||||
# $1 = Path to move results
|
||||
# Outputs:
|
||||
# Writes info to stdout
|
||||
#######################################
|
||||
collect() {
|
||||
|
||||
[ $# -eq 0 ] && { echo "Usage: $0 dir-model"; exit 1; }
|
||||
|
||||
collection="$1"
|
||||
|
||||
dirResult=results/"$collection"
|
||||
dirSettings="$dirResult"/settings
|
||||
|
||||
if [ ! -d "$dirResult" ]
|
||||
then
|
||||
|
||||
echo " # Collecting results and settings into $dirResult"
|
||||
|
||||
mkdir -p "$dirResult"
|
||||
mkdir -p "$dirSettings"
|
||||
|
||||
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"
|
||||
[ -d constant ] && mv -f constant "$dirResult"
|
||||
[ -d system ] && mv -f system "$dirResult"
|
||||
|
||||
echo " # Cleaning up the case"
|
||||
|
||||
cleanTimeDirectories
|
||||
cleanPostProcessing
|
||||
|
||||
else
|
||||
|
||||
echo " # Directory $dirResult already exists"
|
||||
echo " # Skipping the computation"
|
||||
|
||||
fi
|
||||
}
|
||||
|
||||
|
||||
#------------------------------------------------------------------------------
|
||||
|
||||
sed -e "s|RAS_MODEL|$RASmodel|g" \
|
||||
constant/turbulenceProperties.template \
|
||||
> constant/turbulenceProperties
|
||||
sed -e "s|L_MAX|$Lmax|g" constant/fvOptions.template > constant/fvOptions
|
||||
sed -e "s|Q_PLANT|$qPlant|g" 0/qPlant.template > 0/qPlant
|
||||
rm -f 0/qPlant.template
|
||||
for setup in $setups
|
||||
do
|
||||
|
||||
runApplication renumberMesh -overwrite
|
||||
echo ""
|
||||
echo "# Computations for the setup: $setup"
|
||||
echo ""
|
||||
|
||||
runApplication $(getApplication)
|
||||
dirSetup="setups.orig/$setup"
|
||||
|
||||
if [ ! -d "$dirSetup" ]
|
||||
then
|
||||
echo "Setup directory: $dirSetup" \
|
||||
"could not be found - skipping execution" 1>&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
cp -rfL "$dirSetup/0.orig" .
|
||||
cp -rfL "$dirSetup/constant" .
|
||||
cp -rfL "$dirSetup/system" .
|
||||
cp -rf 0.orig/ 0/
|
||||
|
||||
if [ ! -d constant/polyMesh ]
|
||||
then
|
||||
|
||||
runApplication blockMesh
|
||||
|
||||
runApplication renumberMesh -overwrite -constant
|
||||
|
||||
runApplication checkMesh -allTopology -allGeometry -constant
|
||||
|
||||
fi
|
||||
|
||||
if [ "$parallel" = true ]
|
||||
then
|
||||
|
||||
runApplication decomposePar
|
||||
|
||||
runParallel $(getApplication)
|
||||
|
||||
runApplication reconstructPar
|
||||
|
||||
else
|
||||
|
||||
runApplication $(getApplication)
|
||||
|
||||
fi
|
||||
|
||||
# Scale up all the dimensions of the precursor computational domain
|
||||
# to encapsulate the successor domain, so that mapFields can be used
|
||||
runApplication transformPoints -scale '(10 10 1)' -translate '(0 0 20)'
|
||||
|
||||
collect "$setup"
|
||||
|
||||
done
|
||||
|
||||
# Scale up all the dimensions of the precursor computational domain
|
||||
# to encapsulate the successor domain, so that mapFields can be used
|
||||
runApplication transformPoints -scale '(10 10 1)' -translate '(0 0 20)'
|
||||
|
||||
#------------------------------------------------------------------------------
|
||||
|
||||
@ -1,10 +0,0 @@
|
||||
#!/bin/sh
|
||||
cd "${0%/*}" || exit # Run from this directory
|
||||
. ${WM_PROJECT_DIR:?}/bin/tools/RunFunctions # Tutorial run functions
|
||||
#------------------------------------------------------------------------------
|
||||
|
||||
restore0Dir
|
||||
|
||||
runApplication blockMesh
|
||||
|
||||
#------------------------------------------------------------------------------
|
||||
@ -3,54 +3,65 @@ cd "${0%/*}" || exit # Run from this directory
|
||||
. ${WM_PROJECT_DIR:?}/bin/tools/RunFunctions # Tutorial run functions
|
||||
#------------------------------------------------------------------------------
|
||||
|
||||
# Benchmark dataset:
|
||||
# Lettau, H. (1950).
|
||||
# A re-examination of the "Leipzig wind profile" considering some
|
||||
# relations between wind and turbulence in the frictional layer.
|
||||
# Tellus, 2(2), 125-129.
|
||||
# DOI:10.3402/tellusa.v2i2.8534
|
||||
#
|
||||
# Koblitz, T. (2013).
|
||||
# CFD Modeling of Non-Neutral Atmospheric Boundary Layer Conditions.
|
||||
# DTU Wind Energy. DTU Wind Energy PhD, No. 0019(EN).
|
||||
# Figure 4.1
|
||||
# settings
|
||||
|
||||
# operand setups
|
||||
setups="
|
||||
kEpsilon-neutral-stability
|
||||
kOmegaSST-neutral-stability
|
||||
"
|
||||
|
||||
|
||||
#------------------------------------------------------------------------------
|
||||
|
||||
plotU() {
|
||||
sample=$1
|
||||
plot_u_vs_z() {
|
||||
|
||||
echo " Plotting the ground-normal streamwise flow speed profile."
|
||||
echo " # Plots for the ground-normal streamwise flow speed profile"
|
||||
|
||||
setup="$1"
|
||||
endTime="$2"
|
||||
|
||||
benchmarkFile="$FOAM_TUTORIALS/resources/dataset/atm-Koblitz-2013/u-z-Leipzig.dat"
|
||||
sampleFile="results/$setup/postProcessing/sampleLines/$endTime/lineZ1_U.xy"
|
||||
image="plots/$setup/u_z.png"
|
||||
|
||||
outName="plots/u-z.png"
|
||||
gnuplot<<PLT_U
|
||||
set terminal pngcairo font "helvetica,20" size 600, 1000
|
||||
set xrange [0:25]
|
||||
set yrange [0:3000]
|
||||
set grid
|
||||
set key left top
|
||||
set xrange [0:25]
|
||||
set yrange [0:3000]
|
||||
set key samplen 2
|
||||
set key spacing 0.75
|
||||
set xlabel "u [m/s]"
|
||||
set ylabel "z [m]"
|
||||
set offset .05, .05
|
||||
set output "$outName"
|
||||
set output "$image"
|
||||
|
||||
bench="system/atm-Koblitz-2013/u-z-Leipzig.dat"
|
||||
sample="$sample"
|
||||
# Benchmark - experimental
|
||||
benchmark="$benchmarkFile"
|
||||
|
||||
# OpenFOAM
|
||||
samples="$sampleFile"
|
||||
|
||||
plot \
|
||||
bench every ::0::16 u 1:2 t "Leipzig" w p ps 2 pt 6 lc rgb "#000000", \
|
||||
sample u 2:1 t "Neutral" w l lw 2 lc rgb "#D55E00"
|
||||
benchmark every ::0::16 u 1:2 t "Leipzig" w p ps 2 pt 6 lc rgb "#000000", \
|
||||
samples u 2:1 t "OpenFOAM" w l lw 2 lc rgb "#D55E00"
|
||||
PLT_U
|
||||
}
|
||||
|
||||
|
||||
plotV() {
|
||||
sample=$1
|
||||
plot_v_vs_z() {
|
||||
|
||||
echo " Plotting the ground-normal spanwise flow speed profile."
|
||||
echo " # Plots for the ground-normal spanwise flow speed profile"
|
||||
|
||||
setup="$1"
|
||||
endTime="$2"
|
||||
|
||||
benchmarkFile="$FOAM_TUTORIALS/resources/dataset/atm-Koblitz-2013/u-z-Leipzig.dat"
|
||||
sampleFile="results/$setup/postProcessing/sampleLines/$endTime/lineZ1_U.xy"
|
||||
image="plots/$setup/v_z.png"
|
||||
|
||||
outName="plots/v-z.png"
|
||||
gnuplot<<PLT_V
|
||||
set terminal pngcairo font "helvetica,20" size 600, 1000
|
||||
set xrange [-1:6]
|
||||
@ -62,14 +73,17 @@ plotV() {
|
||||
set xlabel "v [m/s]"
|
||||
set ylabel "z [m]"
|
||||
set offset .2, .05
|
||||
set output "$outName"
|
||||
set output "$image"
|
||||
|
||||
bench="system/atm-Koblitz-2013/u-z-Leipzig.dat"
|
||||
sample="$sample"
|
||||
# Benchmark - experimental
|
||||
benchmark="$benchmarkFile"
|
||||
|
||||
# OpenFOAM
|
||||
samples="$sampleFile"
|
||||
|
||||
plot \
|
||||
bench every ::17::35 u 1:2 t "Leipzig" w p ps 2 pt 6 lc rgb "#000000", \
|
||||
sample u 3:1 t "Neutral" w l lw 2 lc rgb "#D55E00"
|
||||
benchmark every ::17::35 u 1:2 t "Leipzig" w p ps 2 pt 6 lc rgb "#000000", \
|
||||
samples u 3:1 t "OpenFOAM" w l lw 2 lc rgb "#D55E00"
|
||||
PLT_V
|
||||
}
|
||||
|
||||
@ -88,23 +102,29 @@ command -v awk >/dev/null || {
|
||||
exit 1
|
||||
}
|
||||
|
||||
# The latestTime in postProcessing/samples
|
||||
timeDir=$(foamListTimes -case postProcessing/samples -latestTime 2>/dev/null)
|
||||
[ -n "$timeDir" ] || {
|
||||
echo "No results found in postProcessing - skipping graph creation" 1>&2
|
||||
exit 1
|
||||
}
|
||||
timeDir="postProcessing/samples/$timeDir"
|
||||
|
||||
# Settings
|
||||
sample="$timeDir/lineZ1_U.xy"
|
||||
stability="neutral"
|
||||
#------------------------------------------------------------------------------
|
||||
|
||||
# Postprocessing
|
||||
mkdir -p plots
|
||||
cp -rf $FOAM_TUTORIALS/resources/dataset/atm-Koblitz-2013 system/.
|
||||
plotU $sample
|
||||
plotV $sample
|
||||
for setup in $setups
|
||||
do
|
||||
|
||||
echo ""
|
||||
echo "# Plots for the setup: $setup"
|
||||
echo ""
|
||||
|
||||
dirPlots="plots/$setup"
|
||||
[ -d "$dirPlots" ] || mkdir -p "$dirPlots"
|
||||
|
||||
endTime=$(\
|
||||
foamDictionary results/$setup/settings/controlDict \
|
||||
-disableFunctionEntries -entry endTime -value \
|
||||
)
|
||||
|
||||
plot_u_vs_z "$setup" "$endTime"
|
||||
|
||||
plot_v_vs_z "$setup" "$endTime"
|
||||
|
||||
done
|
||||
|
||||
|
||||
#------------------------------------------------------------------------------
|
||||
|
||||
@ -20,7 +20,7 @@ internalField uniform 0.0;
|
||||
|
||||
boundaryField
|
||||
{
|
||||
"bottom|top"
|
||||
"(bottom|top)"
|
||||
{
|
||||
type fixedFluxPressure;
|
||||
rho rhok;
|
||||
@ -49,7 +49,7 @@ runTimeModifiable false;
|
||||
|
||||
functions
|
||||
{
|
||||
#includeFunc "samples"
|
||||
#includeFunc "sampleLines"
|
||||
}
|
||||
|
||||
|
||||
@ -0,0 +1,22 @@
|
||||
/*--------------------------------*- C++ -*----------------------------------*\
|
||||
| ========= | |
|
||||
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
|
||||
| \\ / O peration | Version: v2012 |
|
||||
| \\ / A nd | Website: www.openfoam.com |
|
||||
| \\/ M anipulation | |
|
||||
\*---------------------------------------------------------------------------*/
|
||||
FoamFile
|
||||
{
|
||||
version 2.0;
|
||||
format ascii;
|
||||
class dictionary;
|
||||
object decomposeParDict;
|
||||
}
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
numberOfSubdomains 2;
|
||||
|
||||
method scotch;
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -0,0 +1 @@
|
||||
../../common/0.orig/T
|
||||
@ -0,0 +1 @@
|
||||
../../common/0.orig/U
|
||||
@ -0,0 +1 @@
|
||||
../../common/0.orig/alphat
|
||||
@ -0,0 +1 @@
|
||||
../../common/0.orig/k
|
||||
@ -0,0 +1 @@
|
||||
../../common/0.orig/leafAreaDensity
|
||||
@ -0,0 +1 @@
|
||||
../../common/0.orig/nut
|
||||
@ -0,0 +1 @@
|
||||
../../common/0.orig/p_rgh
|
||||
@ -0,0 +1 @@
|
||||
../../common/0.orig/plantCd
|
||||
@ -16,7 +16,7 @@ FoamFile
|
||||
|
||||
dimensions [0 2 -3 0 0 0 0];
|
||||
|
||||
internalField uniform Q_PLANT;
|
||||
internalField uniform 0;
|
||||
|
||||
boundaryField
|
||||
{
|
||||
@ -0,0 +1,101 @@
|
||||
/*--------------------------------*- C++ -*----------------------------------*\
|
||||
| ========= | |
|
||||
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
|
||||
| \\ / O peration | Version: com |
|
||||
| \\ / A nd | Website: www.openfoam.com |
|
||||
| \\/ M anipulation | |
|
||||
\*---------------------------------------------------------------------------*/
|
||||
FoamFile
|
||||
{
|
||||
version 2.0;
|
||||
format ascii;
|
||||
class dictionary;
|
||||
object fvOptions;
|
||||
}
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
pressureGradient
|
||||
{
|
||||
type vectorSemiImplicitSource;
|
||||
volumeMode specific;
|
||||
selectionMode all;
|
||||
injectionRateSuSp
|
||||
{
|
||||
U ( ( 0 0.00197805 0 ) 0 );
|
||||
}
|
||||
}
|
||||
|
||||
atmCoriolisUSource1
|
||||
{
|
||||
type atmCoriolisUSource;
|
||||
atmCoriolisUSourceCoeffs
|
||||
{
|
||||
selectionMode all;
|
||||
Omega ( 0 0 5.65156e-05 );
|
||||
}
|
||||
}
|
||||
|
||||
atmAmbientTurbSource1
|
||||
{
|
||||
type atmAmbientTurbSource;
|
||||
atmAmbientTurbSourceCoeffs
|
||||
{
|
||||
selectionMode all;
|
||||
kAmb 0.0001;
|
||||
epsilonAmb 7.208e-08;
|
||||
}
|
||||
}
|
||||
|
||||
atmBuoyancyTurbSource1
|
||||
{
|
||||
type atmBuoyancyTurbSource;
|
||||
atmBuoyancyTurbSourceCoeffs
|
||||
{
|
||||
selectionMode all;
|
||||
rho rho;
|
||||
Lmax 41.8;
|
||||
beta 0.0033;
|
||||
}
|
||||
}
|
||||
|
||||
atmLengthScaleTurbSource1
|
||||
{
|
||||
type atmLengthScaleTurbSource;
|
||||
atmLengthScaleTurbSourceCoeffs
|
||||
{
|
||||
selectionMode all;
|
||||
Lmax 41.8;
|
||||
n 3;
|
||||
}
|
||||
}
|
||||
|
||||
atmPlantCanopyUSource1
|
||||
{
|
||||
type atmPlantCanopyUSource;
|
||||
atmPlantCanopyUSourceCoeffs
|
||||
{
|
||||
selectionMode all;
|
||||
}
|
||||
}
|
||||
|
||||
atmPlantCanopyTSource1
|
||||
{
|
||||
type atmPlantCanopyTSource;
|
||||
atmPlantCanopyTSourceCoeffs
|
||||
{
|
||||
selectionMode all;
|
||||
}
|
||||
}
|
||||
|
||||
atmPlantCanopyTurbSource1
|
||||
{
|
||||
type atmPlantCanopyTurbSource;
|
||||
atmPlantCanopyTurbSourceCoeffs
|
||||
{
|
||||
selectionMode all;
|
||||
rho rho;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -0,0 +1 @@
|
||||
../../common/constant/g
|
||||
@ -0,0 +1 @@
|
||||
../../common/constant/transportProperties
|
||||
@ -18,14 +18,15 @@ simulationType RAS;
|
||||
|
||||
RAS
|
||||
{
|
||||
RASModel RAS_MODEL;
|
||||
RASModel kEpsilon;
|
||||
|
||||
turbulence on;
|
||||
|
||||
printCoeffs on;
|
||||
|
||||
RAS_MODELCoeffs
|
||||
kEpsilonCoeffs
|
||||
{
|
||||
Cmu 0.09;
|
||||
betaStar 0.09;
|
||||
sigmaEps 1.30;
|
||||
sigmaK 1;
|
||||
C1 1.44;
|
||||
@ -0,0 +1 @@
|
||||
../common/system
|
||||
@ -0,0 +1 @@
|
||||
../../common/0.orig/T
|
||||
@ -0,0 +1 @@
|
||||
../../common/0.orig/U
|
||||
@ -0,0 +1 @@
|
||||
../../common/0.orig/alphat
|
||||
@ -0,0 +1 @@
|
||||
../../common/0.orig/k
|
||||
@ -0,0 +1 @@
|
||||
../../common/0.orig/leafAreaDensity
|
||||
@ -0,0 +1 @@
|
||||
../../common/0.orig/nut
|
||||
@ -0,0 +1 @@
|
||||
../../common/0.orig/p_rgh
|
||||
@ -0,0 +1 @@
|
||||
../../common/0.orig/plantCd
|
||||
@ -16,7 +16,7 @@ FoamFile
|
||||
|
||||
dimensions [0 2 -3 0 0 0 0];
|
||||
|
||||
internalField uniform Q_PLANT;
|
||||
internalField uniform 0;
|
||||
|
||||
boundaryField
|
||||
{
|
||||
@ -0,0 +1,101 @@
|
||||
/*--------------------------------*- C++ -*----------------------------------*\
|
||||
| ========= | |
|
||||
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
|
||||
| \\ / O peration | Version: com |
|
||||
| \\ / A nd | Website: www.openfoam.com |
|
||||
| \\/ M anipulation | |
|
||||
\*---------------------------------------------------------------------------*/
|
||||
FoamFile
|
||||
{
|
||||
version 2.0;
|
||||
format ascii;
|
||||
class dictionary;
|
||||
object fvOptions;
|
||||
}
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
pressureGradient
|
||||
{
|
||||
type vectorSemiImplicitSource;
|
||||
volumeMode specific;
|
||||
selectionMode all;
|
||||
injectionRateSuSp
|
||||
{
|
||||
U ( ( 0 0.00197805 0 ) 0 );
|
||||
}
|
||||
}
|
||||
|
||||
atmCoriolisUSource1
|
||||
{
|
||||
type atmCoriolisUSource;
|
||||
atmCoriolisUSourceCoeffs
|
||||
{
|
||||
selectionMode all;
|
||||
Omega ( 0 0 5.65156e-05 );
|
||||
}
|
||||
}
|
||||
|
||||
atmAmbientTurbSource1
|
||||
{
|
||||
type atmAmbientTurbSource;
|
||||
atmAmbientTurbSourceCoeffs
|
||||
{
|
||||
selectionMode all;
|
||||
kAmb 0.0001;
|
||||
epsilonAmb 7.208e-08;
|
||||
}
|
||||
}
|
||||
|
||||
atmBuoyancyTurbSource1
|
||||
{
|
||||
type atmBuoyancyTurbSource;
|
||||
atmBuoyancyTurbSourceCoeffs
|
||||
{
|
||||
selectionMode all;
|
||||
rho rho;
|
||||
Lmax 41.8;
|
||||
beta 0.0033;
|
||||
}
|
||||
}
|
||||
|
||||
atmLengthScaleTurbSource1
|
||||
{
|
||||
type atmLengthScaleTurbSource;
|
||||
atmLengthScaleTurbSourceCoeffs
|
||||
{
|
||||
selectionMode all;
|
||||
Lmax 41.8;
|
||||
n 3;
|
||||
}
|
||||
}
|
||||
|
||||
atmPlantCanopyUSource1
|
||||
{
|
||||
type atmPlantCanopyUSource;
|
||||
atmPlantCanopyUSourceCoeffs
|
||||
{
|
||||
selectionMode all;
|
||||
}
|
||||
}
|
||||
|
||||
atmPlantCanopyTSource1
|
||||
{
|
||||
type atmPlantCanopyTSource;
|
||||
atmPlantCanopyTSourceCoeffs
|
||||
{
|
||||
selectionMode all;
|
||||
}
|
||||
}
|
||||
|
||||
atmPlantCanopyTurbSource1
|
||||
{
|
||||
type atmPlantCanopyTurbSource;
|
||||
atmPlantCanopyTurbSourceCoeffs
|
||||
{
|
||||
selectionMode all;
|
||||
rho rho;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -0,0 +1 @@
|
||||
../../common/constant/g
|
||||
@ -0,0 +1 @@
|
||||
../../common/constant/transportProperties
|
||||
@ -0,0 +1,37 @@
|
||||
/*--------------------------------*- C++ -*----------------------------------*\
|
||||
| ========= | |
|
||||
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
|
||||
| \\ / O peration | Version: v2012 |
|
||||
| \\ / A nd | Website: www.openfoam.com |
|
||||
| \\/ M anipulation | |
|
||||
\*---------------------------------------------------------------------------*/
|
||||
FoamFile
|
||||
{
|
||||
version 2.0;
|
||||
format ascii;
|
||||
class dictionary;
|
||||
object turbulenceProperties;
|
||||
}
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
simulationType RAS;
|
||||
|
||||
RAS
|
||||
{
|
||||
RASModel kOmegaSST;
|
||||
|
||||
turbulence on;
|
||||
|
||||
printCoeffs on;
|
||||
|
||||
kOmegaSSTCoeffs
|
||||
{
|
||||
betaStar 0.09;
|
||||
sigmaK 1;
|
||||
C1 1.44;
|
||||
C2 1.92;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -0,0 +1 @@
|
||||
../common/system
|
||||
@ -5,7 +5,10 @@ cd "${0%/*}" || exit # Run from this directory
|
||||
|
||||
cleanCase0
|
||||
|
||||
rm -rf constant/polyMesh
|
||||
rm -f constant/turbulenceProperties
|
||||
rm -rf 0.orig
|
||||
rm -rf system
|
||||
rm -rf constant
|
||||
rm -rf results
|
||||
rm -rf plots
|
||||
|
||||
#------------------------------------------------------------------------------
|
||||
#------------------------------------------------------------------------------
|
||||
@ -1,26 +1,130 @@
|
||||
#!/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
|
||||
#------------------------------------------------------------------------------
|
||||
|
||||
RASModel="kEpsilon" # "kOmegaSST"
|
||||
# settings
|
||||
|
||||
sed -e "s|RAS_MODEL|$RASModel|g" \
|
||||
constant/turbulenceProperties.template \
|
||||
> constant/turbulenceProperties
|
||||
# operand setups (only neutral stability)
|
||||
setups="
|
||||
kEpsilon
|
||||
kOmegaSST
|
||||
"
|
||||
|
||||
restore0Dir
|
||||
# flag to enable computations in parallel mode
|
||||
parallel=true
|
||||
|
||||
|
||||
#------------------------------------------------------------------------------
|
||||
|
||||
#######################################
|
||||
# Collect results and mesh into a given path
|
||||
# and clean the case for the next run
|
||||
# Arguments:
|
||||
# $1 = Path to move results
|
||||
# Outputs:
|
||||
# Writes info to stdout
|
||||
#######################################
|
||||
collect() {
|
||||
|
||||
[ $# -eq 0 ] && { echo "Usage: $0 dir-model"; exit 1; }
|
||||
|
||||
collection="$1"
|
||||
|
||||
dirResult=results/"$collection"
|
||||
dirSettings="$dirResult"/settings
|
||||
|
||||
if [ ! -d "$dirResult" ]
|
||||
then
|
||||
|
||||
echo " # Collecting results and settings into $dirResult"
|
||||
|
||||
mkdir -p "$dirResult"
|
||||
mkdir -p "$dirSettings"
|
||||
|
||||
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"
|
||||
[ -d constant ] && mv -f constant "$dirResult"
|
||||
[ -d system ] && mv -f system "$dirResult"
|
||||
|
||||
echo " # Cleaning up the case"
|
||||
|
||||
cleanTimeDirectories
|
||||
cleanPostProcessing
|
||||
|
||||
else
|
||||
|
||||
echo " # Directory $dirResult already exists"
|
||||
echo " # Skipping the computation"
|
||||
|
||||
fi
|
||||
}
|
||||
|
||||
|
||||
#------------------------------------------------------------------------------
|
||||
|
||||
for setup in $setups
|
||||
do
|
||||
|
||||
echo ""
|
||||
echo "# Computations for the setup: $setup"
|
||||
echo ""
|
||||
|
||||
dirSetup="setups.orig/$setup"
|
||||
|
||||
if [ ! -d "$dirSetup" ]
|
||||
then
|
||||
echo "Setup directory: $dirSetup" \
|
||||
"could not be found - skipping execution" 1>&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
cp -rfL "$dirSetup/0.orig" .
|
||||
cp -rfL "$dirSetup/constant" .
|
||||
cp -rfL "$dirSetup/system" .
|
||||
cp -rf 0.orig/ 0/
|
||||
|
||||
if [ ! -d constant/polyMesh ]
|
||||
then
|
||||
|
||||
runApplication blockMesh
|
||||
|
||||
runApplication topoSet
|
||||
|
||||
runApplication createPatch -overwrite
|
||||
|
||||
runApplication renumberMesh -overwrite -constant
|
||||
|
||||
runApplication checkMesh -allTopology -allGeometry -constant
|
||||
|
||||
fi
|
||||
|
||||
runApplication mapFields \
|
||||
../precursor/results/"$setup" -sourceTime latestTime
|
||||
|
||||
if [ "$parallel" = true ]
|
||||
then
|
||||
|
||||
runApplication decomposePar
|
||||
|
||||
runParallel $(getApplication)
|
||||
|
||||
runApplication reconstructPar
|
||||
|
||||
else
|
||||
|
||||
runApplication $(getApplication)
|
||||
|
||||
fi
|
||||
|
||||
collect "$setup"
|
||||
|
||||
done
|
||||
|
||||
cp -rf constant/polyMesh.orig constant/polyMesh
|
||||
|
||||
runApplication mapFields ../precursor -sourceTime latestTime
|
||||
|
||||
runApplication decomposePar -force
|
||||
|
||||
runParallel renumberMesh -overwrite
|
||||
|
||||
runParallel $(getApplication)
|
||||
|
||||
runApplication reconstructPar -latestTime
|
||||
|
||||
#------------------------------------------------------------------------------
|
||||
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user