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:
@ -5,7 +5,10 @@ cd "${0%/*}" || exit # Run from this directory
|
||||
|
||||
cleanCase0
|
||||
|
||||
rm -f positionClean.dat
|
||||
rm -f OF_vs_Exact.eps
|
||||
rm -rf 0.orig
|
||||
rm -rf system
|
||||
rm -rf constant
|
||||
rm -rf results
|
||||
rm -rf plots
|
||||
|
||||
#------------------------------------------------------------------------------
|
||||
142
tutorials/verificationAndValidation/StefanProblem/Allrun
Executable file
142
tutorials/verificationAndValidation/StefanProblem/Allrun
Executable file
@ -0,0 +1,142 @@
|
||||
#!/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="
|
||||
icoReactingMultiphaseInterFoam
|
||||
interCondensatingEvaporatingFoam
|
||||
"
|
||||
|
||||
# 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/
|
||||
cp -rf 0/ 1.36/
|
||||
|
||||
if [ ! -d constant/polyMesh ]
|
||||
then
|
||||
|
||||
runApplication blockMesh
|
||||
|
||||
runApplication renumberMesh -overwrite -constant
|
||||
|
||||
runApplication checkMesh -allTopology -allGeometry -constant
|
||||
|
||||
if [ ! -f "system/setAlphaFieldDict" ]
|
||||
then
|
||||
if [ -f "system/setAlphaFieldDict.liquid" ]
|
||||
then
|
||||
runApplication -s liquid \
|
||||
setAlphaField -dict system/setAlphaFieldDict.liquid
|
||||
fi
|
||||
|
||||
if [ -f "system/setAlphaFieldDict.gas" ]
|
||||
then
|
||||
runApplication -s gas \
|
||||
setAlphaField -dict system/setAlphaFieldDict.gas
|
||||
fi
|
||||
else
|
||||
runApplication setAlphaField
|
||||
fi
|
||||
|
||||
fi
|
||||
|
||||
if [ "$parallel" = true ]
|
||||
then
|
||||
|
||||
runApplication decomposePar
|
||||
|
||||
runParallel -s parallel renumberMesh -overwrite
|
||||
|
||||
runParallel $(getApplication)
|
||||
|
||||
runApplication reconstructPar
|
||||
|
||||
else
|
||||
|
||||
runApplication $(getApplication)
|
||||
|
||||
fi
|
||||
|
||||
collect "$setup"
|
||||
|
||||
done
|
||||
|
||||
|
||||
#------------------------------------------------------------------------------
|
||||
81
tutorials/verificationAndValidation/StefanProblem/plot
Executable file
81
tutorials/verificationAndValidation/StefanProblem/plot
Executable file
@ -0,0 +1,81 @@
|
||||
#!/bin/bash
|
||||
cd "${0%/*}" || exit # Run from this directory
|
||||
. ${WM_PROJECT_DIR:?}/bin/tools/RunFunctions # Tutorial run functions
|
||||
#------------------------------------------------------------------------------
|
||||
|
||||
# settings
|
||||
|
||||
# operand setups
|
||||
setups="
|
||||
icoReactingMultiphaseInterFoam
|
||||
interCondensatingEvaporatingFoam
|
||||
"
|
||||
|
||||
|
||||
#------------------------------------------------------------------------------
|
||||
|
||||
plot_t_vs_x() {
|
||||
|
||||
setup="$1"
|
||||
|
||||
benchmarkFile="$FOAM_TUTORIALS/resources/dataset/StefanProblem.dat"
|
||||
|
||||
sampleFile0="results/$setup/postProcessing/interfaceHeight1/1.36"
|
||||
sampleFile="$sampleFile0/positionClean.dat"
|
||||
sed -e 's/[()]//g' "$sampleFile0/position.dat" > "$sampleFile"
|
||||
image="plots/$setup/t_vs_x.png"
|
||||
|
||||
gnuplot<<EOF
|
||||
set terminal pngcairo font "helvetica,20" size 1000, 1000
|
||||
set grid
|
||||
set key left top
|
||||
set xlabel "t [sec]"
|
||||
set ylabel "x [mm]"
|
||||
set output "$image"
|
||||
|
||||
# Benchmark - analytical
|
||||
benchmark="$benchmarkFile"
|
||||
|
||||
# OpenFOAM
|
||||
samples="$sampleFile"
|
||||
|
||||
plot \
|
||||
benchmark u 1:2 t "Analytical", \
|
||||
samples u 1:2 t "OpenFOAM" with line lt -1 lw 1
|
||||
EOF
|
||||
}
|
||||
|
||||
|
||||
#------------------------------------------------------------------------------
|
||||
|
||||
# Requires gnuplot
|
||||
command -v gnuplot >/dev/null || {
|
||||
echo "FOAM FATAL ERROR: gnuplot not found - skipping graph creation" 1>&2
|
||||
exit 1
|
||||
}
|
||||
|
||||
# Check "results" directory
|
||||
[ -d "results" ] || {
|
||||
echo "FOAM FATAL ERROR: 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"
|
||||
|
||||
plot_t_vs_x "$setup"
|
||||
|
||||
done
|
||||
|
||||
|
||||
#------------------------------------------------------------------------------
|
||||
@ -43,4 +43,5 @@ boundaryField
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -9,38 +9,41 @@ FoamFile
|
||||
{
|
||||
version 2.0;
|
||||
format ascii;
|
||||
class volVectorField;
|
||||
object U;
|
||||
class volScalarField;
|
||||
object p_rgh;
|
||||
}
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
dimensions [0 1 -1 0 0 0 0];
|
||||
dimensions [1 -1 -2 0 0 0 0];
|
||||
|
||||
internalField uniform (0 0 0);
|
||||
internalField uniform 1e5;
|
||||
|
||||
boundaryField
|
||||
{
|
||||
sideWalls
|
||||
{
|
||||
type slip;
|
||||
value uniform (0 0 0);
|
||||
type fixedFluxPressure;
|
||||
}
|
||||
|
||||
faceWall
|
||||
{
|
||||
type noSlip;
|
||||
type fixedFluxPressure;
|
||||
}
|
||||
|
||||
outlet
|
||||
{
|
||||
//type fixedValue;
|
||||
type totalPressure;
|
||||
rho rho;
|
||||
p0 uniform 1e5;
|
||||
value uniform 1e5;
|
||||
}
|
||||
|
||||
frontAndBack
|
||||
{
|
||||
type empty;
|
||||
}
|
||||
|
||||
outlet
|
||||
{
|
||||
type pressureInletOutletVelocity;
|
||||
value uniform (0 0 0);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -10,7 +10,6 @@ FoamFile
|
||||
version 2.0;
|
||||
format ascii;
|
||||
class uniformDimensionedVectorField;
|
||||
location "constant";
|
||||
object g;
|
||||
}
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
@ -46,4 +46,5 @@ sigma 0;
|
||||
|
||||
Prt 0.7;
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -10,7 +10,6 @@ FoamFile
|
||||
version 2.0;
|
||||
format ascii;
|
||||
class dictionary;
|
||||
location "constant";
|
||||
object turbulenceProperties;
|
||||
}
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
@ -38,12 +38,11 @@ patches
|
||||
(
|
||||
wall faceWall
|
||||
(
|
||||
(0 4 7 3)
|
||||
(0 4 7 3)
|
||||
)
|
||||
|
||||
patch outlet
|
||||
(
|
||||
(2 6 5 1)
|
||||
(2 6 5 1)
|
||||
)
|
||||
empty frontAndBack
|
||||
(
|
||||
@ -51,8 +50,8 @@ patches
|
||||
(4 5 6 7)
|
||||
(1 5 4 0)
|
||||
(3 7 6 2)
|
||||
|
||||
)
|
||||
);
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -10,12 +10,13 @@ FoamFile
|
||||
version 2.0;
|
||||
format ascii;
|
||||
class dictionary;
|
||||
location "constant";
|
||||
object turbulenceProperties;
|
||||
object decomposeParDict;
|
||||
}
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
simulationType laminar;
|
||||
numberOfSubdomains 2;
|
||||
|
||||
method scotch;
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -44,4 +44,5 @@ boundaryField
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -0,0 +1 @@
|
||||
../../common/0.orig/U
|
||||
@ -36,4 +36,5 @@ boundaryField
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -36,4 +36,5 @@ boundaryField
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -0,0 +1 @@
|
||||
../../common/0.orig/p_rgh
|
||||
@ -0,0 +1 @@
|
||||
../../common/constant/g
|
||||
@ -47,4 +47,5 @@ massTransferModel
|
||||
}
|
||||
);
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -25,8 +25,6 @@ thermoType
|
||||
energy sensibleEnthalpy;
|
||||
}
|
||||
|
||||
// ************************************************************************* //
|
||||
|
||||
mixture
|
||||
{
|
||||
specie
|
||||
@ -40,7 +38,7 @@ mixture
|
||||
}
|
||||
thermodynamics
|
||||
{
|
||||
Hf 0;//-1.338e7; //[J/kg]
|
||||
Hf 0; //[J/kg]
|
||||
Cp 2030;
|
||||
}
|
||||
transport
|
||||
@ -0,0 +1 @@
|
||||
../../common/constant/transportProperties
|
||||
@ -0,0 +1 @@
|
||||
../../common/constant/turbulenceProperties
|
||||
@ -0,0 +1 @@
|
||||
../../common/system/blockMeshDict
|
||||
@ -10,7 +10,6 @@ FoamFile
|
||||
version 2.0;
|
||||
format ascii;
|
||||
class dictionary;
|
||||
location "system";
|
||||
object controlDict;
|
||||
}
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
@ -51,7 +50,6 @@ maxCo 0.01;
|
||||
maxAlphaCo 0.01;
|
||||
maxAlphaDdt 0.01;
|
||||
|
||||
|
||||
functions
|
||||
{
|
||||
|
||||
@ -83,7 +81,6 @@ functions
|
||||
writeControl timeStep;
|
||||
writeInterval 3;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
@ -0,0 +1 @@
|
||||
../../common/system/decomposeParDict
|
||||
@ -63,4 +63,5 @@ fluxRequired
|
||||
"alpha.*";
|
||||
}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -108,4 +108,5 @@ relaxationFactors
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -10,14 +10,14 @@ FoamFile
|
||||
version 2.0;
|
||||
format ascii;
|
||||
class dictionary;
|
||||
location "system/fluid";
|
||||
object setFieldsDict;
|
||||
}
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
field "alpha.gas";
|
||||
type plane;
|
||||
origin (0.503e-3 0 0);
|
||||
normal (-1 0 0);
|
||||
field "alpha.gas";
|
||||
type plane;
|
||||
origin (0.503e-3 0 0);
|
||||
normal (-1 0 0);
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -10,14 +10,14 @@ FoamFile
|
||||
version 2.0;
|
||||
format ascii;
|
||||
class dictionary;
|
||||
location "system/fluid";
|
||||
object setFieldsDict;
|
||||
}
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
field "alpha.liquid";
|
||||
type plane;
|
||||
origin (0.503e-3 0 0);
|
||||
normal (1 0 0);
|
||||
field "alpha.liquid";
|
||||
type plane;
|
||||
origin (0.503e-3 0 0);
|
||||
normal (1 0 0);
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -0,0 +1 @@
|
||||
../../common/0.orig/U
|
||||
@ -0,0 +1 @@
|
||||
../../common/0.orig/p_rgh
|
||||
@ -0,0 +1 @@
|
||||
../../common/constant/g
|
||||
@ -0,0 +1 @@
|
||||
../../common/constant/transportProperties
|
||||
@ -0,0 +1 @@
|
||||
../../common/constant/turbulenceProperties
|
||||
@ -0,0 +1 @@
|
||||
../../common/system/blockMeshDict
|
||||
@ -0,0 +1 @@
|
||||
../../common/system/decomposeParDict
|
||||
@ -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"
|
||||
}
|
||||
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user