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

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

View File

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

View File

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

View File

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

View File

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

View File

@ -20,7 +20,7 @@ internalField uniform 0.0;
boundaryField
{
"bottom|top"
"(bottom|top)"
{
type fixedFluxPressure;
rho rhok;

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 decomposeParDict;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
numberOfSubdomains 2;
method scotch;
// ************************************************************************* //

View File

@ -1,7 +1,7 @@
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: v2012 |
| \\ / O peration | Version: com |
| \\ / A nd | Website: www.openfoam.com |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
@ -16,87 +16,80 @@ FoamFile
pressureGradient
{
type vectorSemiImplicitSource;
volumeMode specific;
selectionMode all;
type vectorSemiImplicitSource;
volumeMode specific;
selectionMode all;
injectionRateSuSp
{
U ((0 1.978046e-03 0) 0);
U ( ( 0 0.00197805 0 ) 0 );
}
}
atmCoriolisUSource1
{
type atmCoriolisUSource;
type atmCoriolisUSource;
atmCoriolisUSourceCoeffs
{
selectionMode all;
Omega (0 0 5.65156e-05);
Omega ( 0 0 5.65156e-05 );
}
}
atmAmbientTurbSource1
{
type atmAmbientTurbSource;
type atmAmbientTurbSource;
atmAmbientTurbSourceCoeffs
{
selectionMode all;
kAmb 1.0e-04;
kAmb 0.0001;
epsilonAmb 7.208e-08;
}
}
atmBuoyancyTurbSource1
{
type atmBuoyancyTurbSource;
type atmBuoyancyTurbSource;
atmBuoyancyTurbSourceCoeffs
{
selectionMode all;
rho rho;
Lmax L_MAX;
beta 3.3e-03;
Lmax 41.8;
beta 0.0033;
}
}
atmLengthScaleTurbSource1
{
type atmLengthScaleTurbSource;
type atmLengthScaleTurbSource;
atmLengthScaleTurbSourceCoeffs
{
selectionMode all;
Lmax L_MAX;
n 3.0;
Lmax 41.8;
n 3;
}
}
atmPlantCanopyUSource1
{
type atmPlantCanopyUSource;
type atmPlantCanopyUSource;
atmPlantCanopyUSourceCoeffs
{
selectionMode all;
}
}
atmPlantCanopyTSource1
{
type atmPlantCanopyTSource;
type atmPlantCanopyTSource;
atmPlantCanopyTSourceCoeffs
{
selectionMode all;
}
}
atmPlantCanopyTurbSource1
{
type atmPlantCanopyTurbSource;
type atmPlantCanopyTurbSource;
atmPlantCanopyTurbSourceCoeffs
{
selectionMode all;

View File

@ -18,14 +18,15 @@ simulationType RAS;
RAS
{
RASModel RAS_MODEL;
RASModel kEpsilon;
turbulence on;
printCoeffs on;
RAS_MODELCoeffs
kEpsilonCoeffs
{
Cmu 0.09;
betaStar 0.09;
sigmaEps 1.30;
sigmaK 1;
C1 1.44;

View File

@ -0,0 +1,36 @@
/*--------------------------------*- 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 qPlant;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
dimensions [0 2 -3 0 0 0 0];
internalField uniform 0;
boundaryField
{
"(bottom|top)"
{
type fixedValue;
value uniform 0;
}
"(inlet|outlet|left|right)"
{
type cyclic;
}
}
// ************************************************************************* //

View File

@ -0,0 +1,101 @@
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: com |
| \\ / A nd | Website: www.openfoam.com |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class dictionary;
object fvOptions;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
pressureGradient
{
type vectorSemiImplicitSource;
volumeMode specific;
selectionMode all;
injectionRateSuSp
{
U ( ( 0 0.00197805 0 ) 0 );
}
}
atmCoriolisUSource1
{
type atmCoriolisUSource;
atmCoriolisUSourceCoeffs
{
selectionMode all;
Omega ( 0 0 5.65156e-05 );
}
}
atmAmbientTurbSource1
{
type atmAmbientTurbSource;
atmAmbientTurbSourceCoeffs
{
selectionMode all;
kAmb 0.0001;
epsilonAmb 7.208e-08;
}
}
atmBuoyancyTurbSource1
{
type atmBuoyancyTurbSource;
atmBuoyancyTurbSourceCoeffs
{
selectionMode all;
rho rho;
Lmax 41.8;
beta 0.0033;
}
}
atmLengthScaleTurbSource1
{
type atmLengthScaleTurbSource;
atmLengthScaleTurbSourceCoeffs
{
selectionMode all;
Lmax 41.8;
n 3;
}
}
atmPlantCanopyUSource1
{
type atmPlantCanopyUSource;
atmPlantCanopyUSourceCoeffs
{
selectionMode all;
}
}
atmPlantCanopyTSource1
{
type atmPlantCanopyTSource;
atmPlantCanopyTSourceCoeffs
{
selectionMode all;
}
}
atmPlantCanopyTurbSource1
{
type atmPlantCanopyTurbSource;
atmPlantCanopyTurbSourceCoeffs
{
selectionMode all;
rho rho;
}
}
// ************************************************************************* //

View File

@ -0,0 +1,37 @@
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: v2012 |
| \\ / A nd | Website: www.openfoam.com |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class dictionary;
object turbulenceProperties;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
simulationType RAS;
RAS
{
RASModel kOmegaSST;
turbulence on;
printCoeffs on;
kOmegaSSTCoeffs
{
betaStar 0.09;
sigmaK 1;
C1 1.44;
C2 1.92;
}
}
// ************************************************************************* //

View File

@ -5,7 +5,10 @@ cd "${0%/*}" || exit # Run from this directory
cleanCase0
rm -rf constant/polyMesh
rm -f constant/turbulenceProperties
rm -rf 0.orig
rm -rf system
rm -rf constant
rm -rf results
rm -rf plots
#------------------------------------------------------------------------------
#------------------------------------------------------------------------------

View File

@ -1,26 +1,130 @@
#!/bin/sh
cd "${0%/*}" || exit # Run from this directory
. ${WM_PROJECT_DIR:?}/bin/tools/RunFunctions # Tutorial run functions
. ${WM_PROJECT_DIR:?}/bin/tools/CleanFunctions # Tutorial clean functions
#------------------------------------------------------------------------------
RASModel="kEpsilon" # "kOmegaSST"
# settings
sed -e "s|RAS_MODEL|$RASModel|g" \
constant/turbulenceProperties.template \
> constant/turbulenceProperties
# operand setups (only neutral stability)
setups="
kEpsilon
kOmegaSST
"
restore0Dir
# flag to enable computations in parallel mode
parallel=true
#------------------------------------------------------------------------------
#######################################
# Collect results and mesh into a given path
# and clean the case for the next run
# Arguments:
# $1 = Path to move results
# Outputs:
# Writes info to stdout
#######################################
collect() {
[ $# -eq 0 ] && { echo "Usage: $0 dir-model"; exit 1; }
collection="$1"
dirResult=results/"$collection"
dirSettings="$dirResult"/settings
if [ ! -d "$dirResult" ]
then
echo " # Collecting results and settings into $dirResult"
mkdir -p "$dirResult"
mkdir -p "$dirSettings"
mv -f $(foamListTimes) "$dirResult"
[ -d postProcessing ] && mv -f postProcessing "$dirResult"
[ -d processor0 ] && mv -f processor* "$dirResult"
mv -f log.* "$dirResult"
cp -f system/{fv*,controlDict} constant/*Properties "$dirSettings"
mv -f 0/ "$dirSettings"
[ -d constant ] && mv -f constant "$dirResult"
[ -d system ] && mv -f system "$dirResult"
echo " # Cleaning up the case"
cleanTimeDirectories
cleanPostProcessing
else
echo " # Directory $dirResult already exists"
echo " # Skipping the computation"
fi
}
#------------------------------------------------------------------------------
for setup in $setups
do
echo ""
echo "# Computations for the setup: $setup"
echo ""
dirSetup="setups.orig/$setup"
if [ ! -d "$dirSetup" ]
then
echo "Setup directory: $dirSetup" \
"could not be found - skipping execution" 1>&2
exit 1
fi
cp -rfL "$dirSetup/0.orig" .
cp -rfL "$dirSetup/constant" .
cp -rfL "$dirSetup/system" .
cp -rf 0.orig/ 0/
if [ ! -d constant/polyMesh ]
then
runApplication blockMesh
runApplication topoSet
runApplication createPatch -overwrite
runApplication renumberMesh -overwrite -constant
runApplication checkMesh -allTopology -allGeometry -constant
fi
runApplication mapFields \
../precursor/results/"$setup" -sourceTime latestTime
if [ "$parallel" = true ]
then
runApplication decomposePar
runParallel $(getApplication)
runApplication reconstructPar
else
runApplication $(getApplication)
fi
collect "$setup"
done
cp -rf constant/polyMesh.orig constant/polyMesh
runApplication mapFields ../precursor -sourceTime latestTime
runApplication decomposePar -force
runParallel renumberMesh -overwrite
runParallel $(getApplication)
runApplication reconstructPar -latestTime
#------------------------------------------------------------------------------

View File

@ -48,12 +48,6 @@ boundaryField
{
type slip;
}
"(upperInterface|lowerInterface)"
{
type cyclicAMI;
value $internalField;
}
}

View File

@ -44,12 +44,6 @@ boundaryField
{
type slip;
}
"(upperInterface|lowerInterface)"
{
type cyclicAMI;
value $internalField;
}
}

View File

@ -49,12 +49,6 @@ boundaryField
{
type slip;
}
"(upperInterface|lowerInterface)"
{
type cyclicAMI;
value $internalField;
}
}

View File

@ -44,12 +44,6 @@ boundaryField
{
type slip;
}
"(upperInterface|lowerInterface)"
{
type cyclicAMI;
value $internalField;
}
}

View File

@ -47,12 +47,6 @@ boundaryField
{
type slip;
}
"(upperInterface|lowerInterface)"
{
type cyclicAMI;
value $internalField;
}
}

View File

@ -37,12 +37,6 @@ boundaryField
type fixedValue;
value uniform 10.123;
}
"(upperInterface|lowerInterface)"
{
type cyclicAMI;
value $internalField;
}
}

Some files were not shown because too many files have changed in this diff Show More