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:
Kutalmis Bercin
2021-06-02 12:44:21 +01:00
parent 48cdf5523b
commit 3384d37a9a
840 changed files with 14574 additions and 41272 deletions

View File

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

View File

@ -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
#------------------------------------------------------------------------------

View File

@ -0,0 +1,112 @@
<!------------------------------------------------------------------------- -->
# Overview
"By setting appropriate profiles for wind velocity and the turbulence
quantities at the inlet, it is often assumed that the boundary layer will
be maintained up to the buildings or obstructions in the flow." (HW:p. 355).
However, it was quantified by (HW:p. 355) that "even in the absence of
obstructions, ..., the velocity and turbulence profiles decay along the
fetch" (HW:p. 355). It was shown by (HW:p. 355) that a set of modifications
were required to maintain a neutral atmospheric boundary layer throughout
an empty and long computational domain of a RANS computation.
## Aim
- Verification of the atmospheric boundary-layer boundary conditions in terms
of the maintenance of inlet quantities downstream within a RANS computation:
- atmBoundaryLayerInletVelocity
- atmBoundaryLayerInletK
- atmBoundaryLayerInletEpsilon
- atmBoundaryLayerInletOmega
## Benchmark (Physical phenomenon)
- The benchmark is an empty fetch computational
domain, steady-state RANS simulation.
- Flow characteristics:
- External flow
- The surface layer portion of the neutral-stratified
equilibrium atmospheric boundary layer (no Ekman layer)
- Dry air
- Homogeneous, smooth terrain
- Spatiotemporal-invariant aerodynamic roughness length
- No displacement height
- Newtonian, single-phase, incompressible, non-reacting
- Benchmark scenario:
- Computational domain: (HW:Fig. 1)
- Benchmark dataset: (HW:Fig. 6)
(Obtained by the WebPlotDigitizer-4.2 (Rohatgi, 2019))
## Resources
Computational study (tag:HW):
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
Wind profile (tag:RQP):
Richards, P. J., Quinn, A. D., & Parker, S. (2002).
A 6 m cube in an atmospheric boundary layer flow-Part 2.
Computational solutions. Wind and structures, 5(2_3_4), 177-192.
DOI:10.12989/was.2002.5.2_3_4.177
# Numerics
## Physical modelling:
- The governing equations for:
- Steady-state, Newtonian, single-phase, incompressible fluid flows,
excluding any thermal chemical, electromagnetic and scalar interactions
- Mathematical approach for the turbulence modelling:
- Reynolds-averaged Navier-Stokes simulation (RANS)
- Turbulence closure model:
- kEpsilon and kOmegaSST linear eddy viscosity closure models
- The sets of input (HW:Table 1):
- Reference height, Zref = 6 [m]
- Aerodynamic roughness height, z0 = 0.01 [m]
- Displacement height, d = 0 [m]
- Reference mean wind speed, Uref = 10 [m/s]
## Computational domain modelling:
- Rectangular prism
- (x1, x2, x3) = (5000, 100, 500) [m] = (streamwise, spanwise, ground-normal) directions
## Computational domain discretisation:
- Spatial resolution:
- (x1, x2, x3) = (500, 5, 50) [cells]
- Refer to the `system/blockMeshDict` for the grading details
- Temporal resolution: Steady state
## Equation discretisation:
- Spatial derivatives and variables:
- Convection: Second order
- Others: Second order with various limiters
- Temporal derivatives and variables: First order
## Numerical boundary/initial conditions:
- Refer to `0.orig`
## Pressure-velocity coupling algorithm:
- SIMPLEC
## Linear solvers:
- Refer to `system/fvSolution`
## Initialisation and sampling:
- No initialisation/averaging
- Sampling at the end of the simulation via `system/sampleDict`
- Refer to `system/controlDict` for further details
<!------------------------------------------------------------------------- -->

View File

@ -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
#------------------------------------------------------------------------------

View File

@ -0,0 +1,66 @@
/*--------------------------------*- 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 volVectorField;
object U;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
dimensions [0 1 -1 0 0 0 0];
internalField uniform (0 0 0);
boundaryField
{
inlet
{
type atmBoundaryLayerInletVelocity;
#include "include/ABLConditions"
value uniform (0 0 0);
}
ground
{
type noSlip;
}
top
{
// (HW:p. 365):
// "In addition, as suggested by RH and often ignored by others, a"
// "constant shear stress of rho*(u^*)^2 was applied at the top boundary."
//
// u^* ~ Uref*kappa/ln((Zref+z0)/z0)
// (HW:Table 1):
// Uref = 10 m/s
// Zref = 6 m
// z0 = 0.01 m
// tau = rho*(u^*)^2 = 0.390796574
type fixedShearStress;
tau (0.390796574 0 0);
value uniform (0 0 0);
}
sides
{
type symmetry;
}
outlet
{
type inletOutlet;
inletValue uniform (0 0 0);
value $internalField;
}
}
// ************************************************************************* //

View File

@ -0,0 +1,19 @@
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: v2012 |
| \\ / A nd | Website: www.openfoam.com |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
kappa 0.40; // (HW:p. 358)
Cmu 0.09; // (HW:p. 358)
flowDir (1 0 0); // (HW:Fig. 1)
zDir (0 0 1); // (HW:Fig. 1)
Uref 10.0; // (HW:Table 1)
Zref 6.0; // (HW:Table 1)
z0 uniform 0.01; // (HW:Table 1)
d uniform 0.0;
// ************************************************************************* //

View File

@ -0,0 +1,55 @@
/*--------------------------------*- 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 volScalarField;
object k;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
dimensions [0 2 -2 0 0 0 0];
internalField uniform 1.3; // (HW:Eq. 6)
boundaryField
{
inlet
{
type atmBoundaryLayerInletK;
#include "include/ABLConditions"
value uniform 0;
}
ground
{
type kqRWallFunction;
value uniform 0.0;
}
top
{
type zeroGradient;
}
sides
{
type symmetry;
}
outlet
{
type inletOutlet;
inletValue $internalField;
value $internalField;
}
}
// ************************************************************************* //

View File

@ -0,0 +1,59 @@
/*--------------------------------*- 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 volScalarField;
object nut;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
dimensions [0 2 -1 0 0 0 0];
internalField uniform 0;
boundaryField
{
#include "include/ABLConditions"
inlet
{
type calculated;
value uniform 0;
}
ground
{
type atmNutkWallFunction;
kappa $kappa;
Cmu $Cmu;
z0 $z0;
value uniform 0.0;
}
top
{
type calculated;
value uniform 0;
}
sides
{
type symmetry;
}
outlet
{
type calculated;
value uniform 0;
}
}
// ************************************************************************* //

View File

@ -0,0 +1,51 @@
/*--------------------------------*- 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 volScalarField;
object p;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
dimensions [0 2 -2 0 0 0 0];
internalField uniform 0;
boundaryField
{
inlet
{
type zeroGradient;
}
ground
{
type zeroGradient;
}
top
{
type zeroGradient;
}
sides
{
type symmetry;
}
outlet
{
type uniformFixedValue;
uniformValue constant 0;
}
}
// ************************************************************************* //

View File

@ -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 transportProperties;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
transportModel Newtonian;
nu 1.5e-05;
// ************************************************************************* //

View File

@ -0,0 +1,111 @@
/*--------------------------------*- 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 blockMeshDict;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
scale 1;
// x = streamwise
// y = spanwise
// z = wall-normal
nx 500;
ny 5;
nz 50;
xMin 0;
xMax 5000.0;
yMin 0;
yMax 100.0;
zMin 0.0;
zMax 500.0;
// blockMesh calculator input:
// width of start cell = 1.0 (HW:p. 359)
// number of cells = 50
// total length = 500
// blockMesh calculator output:
// cell-to-cell expansion ratio = 1.076030437 (consistent with 1.076 (HW:Fig.1))
zTotalExpansion 36.25795062;
vertices
(
($xMin $yMin $zMin)
($xMax $yMin $zMin)
($xMax $yMax $zMin)
($xMin $yMax $zMin)
($xMin $yMin $zMax)
($xMax $yMin $zMax)
($xMax $yMax $zMax)
($xMin $yMax $zMax)
);
blocks
(
hex (0 1 2 3 4 5 6 7) ($nx $ny $nz) simpleGrading (1 1 $zTotalExpansion)
);
edges
(
);
boundary
(
inlet
{
type patch;
faces
(
(0 4 7 3)
);
}
ground
{
type wall;
faces
(
(0 3 2 1)
);
}
top
{
type patch;
faces
(
(4 5 6 7)
);
}
sides
{
type symmetry;
faces
(
(1 5 4 0)
(3 7 6 2)
);
}
outlet
{
type patch;
faces
(
(2 6 5 1)
);
}
);
mergePatchPairs
(
);
// ************************************************************************* //

View File

@ -0,0 +1,67 @@
/*--------------------------------*- 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 controlDict;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
// Make sure all utilities know specialised models
libs (atmosphericModels);
application simpleFoam;
startFrom latestTime;
startTime 0;
stopAt endTime;
endTime 5000;
deltaT 1;
writeControl timeStep;
writeInterval 500;
purgeWrite 0;
writeFormat ascii;
writePrecision 12;
writeCompression off;
timeFormat general;
timePrecision 6;
runTimeModifiable yes;
functions
{
#include "sampleLines"
#include "sampleIso"
#include "samplePlanes"
minMax
{
type fieldMinMax;
libs (fieldFunctionObjects);
writeControl writeTime;
fields (U);
}
}
// ************************************************************************* //

View File

@ -0,0 +1,27 @@
/*--------------------------------*- 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 8;
method hierarchical;
coeffs
{
n (8 1 1);
}
// ************************************************************************* //

View File

@ -0,0 +1,62 @@
/*--------------------------------*- 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 fvSchemes;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
ddtSchemes
{
default steadyState;
}
gradSchemes
{
default Gauss linear;
}
divSchemes
{
default none;
div(phi,U) bounded Gauss linear;
turbulence bounded Gauss limitedLinear 1;
div(phi,epsilon) $turbulence;
div(phi,omega) $turbulence;
div(phi,k) $turbulence;
div((nuEff*dev2(T(grad(U))))) Gauss linear;
}
laplacianSchemes
{
default Gauss linear uncorrected;
}
interpolationSchemes
{
default linear;
}
snGradSchemes
{
default uncorrected;
}
wallDist
{
method meshWave;
}
// ************************************************************************* //

View File

@ -0,0 +1,59 @@
/*--------------------------------*- 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 fvSolution;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
solvers
{
p
{
solver GAMG;
smoother GaussSeidel;
tolerance 1e-8;
relTol 0.01;
}
"(U|k|epsilon|omega)"
{
solver smoothSolver;
smoother GaussSeidel;
tolerance 1e-8;
relTol 0.01;
}
}
SIMPLE
{
nNonOrthogonalCorrectors 0;
consistent true;
pRefCell 0;
pRefValue 0;
}
relaxationFactors
{
equations
{
U 0.9;
"(k|epsilon|omega)" 0.7;
}
}
cache
{
grad(U);
}
// ************************************************************************* //

View File

@ -0,0 +1,25 @@
// -*- C++ -*-
sampleIso
{
type surfaces;
libs (sampling);
writeControl writeTime;
surfaceFormat vtk;
fields (U k epsilon nut);
surfaces
{
envelope
{
type isoSurface;
isoMethod topo;
isoField k;
isoValues (1.28 1.29 1.30 1.31 1.32 1.33);
}
}
}
// *********************************************************************** //

View File

@ -0,0 +1,99 @@
// -*- C++ -*-
// The locations of the sample profiles correspond to:
// Hargreaves-Wright (2007), Fig.6
// DOI:10.1016/j.jweia.2006.08.002
_sampler
{
type sets;
libs (sampling);
setFormat raw;
interpolationScheme cell;
writeControl writeTime;
enabled false;
sets
(
x_0mPatch // inlet patch face centres
{
type face;
axis z;
start (0 50 0);
end (0 50 500);
}
x_0mCell // inlet-first cell centres
{
type midPoint;
axis z;
start (5.0 50 0);
end (5.0 50 500);
}
x_2500m
{
type face;
axis z;
start (2500 50 0);
end (2500 50 500);
}
x_4000m
{
type face;
axis z;
start (4000 50 0);
end (4000 50 500);
}
x_5000mCell // outlet patch face centres
{
type face;
axis z;
start (4995 50 0);
end (4995 50 500);
}
x_5000mPatch // outlet-first cell centres
{
type face;
axis z;
start (5000 50 0);
end (5000 50 500);
}
);
}
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;
}
// *********************************************************************** //

View File

@ -0,0 +1,30 @@
// -*- C++ -*-
samplePlanes
{
type surfaces;
libs (sampling);
writeControl writeTime;
surfaceFormat vtk;
fields (U k epsilon nut);
surfaces
{
planes
{
type cuttingPlane;
planeType pointAndNormal;
pointAndNormalDict
{
point (1e-8 0 0); // slightly inside the domain
normal (1 0 0);
}
offsets ( 500 1000 1500 2000 2500 3000 3500 4000 4500 );
}
}
}
// *********************************************************************** //

View File

@ -0,0 +1,59 @@
/*--------------------------------*- 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 volScalarField;
object epsilon;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
dimensions [0 2 -3 0 0 0 0];
internalField uniform 0.01;
boundaryField
{
#include "include/ABLConditions"
inlet
{
type atmBoundaryLayerInletEpsilon;
#include "include/ABLConditions"
value uniform 0;
}
ground
{
type epsilonWallFunction;
Cmu $Cmu;
kappa $kappa;
value $internalField;
}
top
{
type zeroGradient;
}
sides
{
type symmetry;
}
outlet
{
type inletOutlet;
inletValue $internalField;
value $internalField;
}
}
// ************************************************************************* //

View File

@ -0,0 +1,44 @@
/*--------------------------------*- 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 kEpsilon;
turbulence on;
printCoeffs on;
kEpsilonCoeffs // Valid only for epsilon-based models
{
Cmu 0.09;
C1 1.44;
C2 1.92;
sigmaEps 1.11; //Original value:1.44
// See p. 358:
// 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
}
}
// ************************************************************************* //

View File

@ -0,0 +1,59 @@
/*--------------------------------*- 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 volScalarField;
object omega;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
dimensions [0 0 -1 0 0 0 0];
internalField uniform 0.0007;
boundaryField
{
#include "include/ABLConditions"
inlet
{
type atmBoundaryLayerInletOmega;
#include "include/ABLConditions"
value uniform 0;
}
ground
{
type omegaWallFunction;
Cmu $Cmu;
kappa $kappa;
value $internalField;
}
top
{
type zeroGradient;
}
sides
{
type symmetry;
}
outlet
{
type inletOutlet;
inletValue $internalField;
value $internalField;
}
}
// ************************************************************************* //

View File

@ -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;
}
// ************************************************************************* //