ENH: simplify turbulentDigitalFilterInlet BC

This commit is contained in:
Kutalmis Bercin
2020-04-27 09:18:30 +01:00
committed by Andrew Heather
parent 4a798b9ea5
commit 60809c3f50
34 changed files with 851 additions and 1041 deletions

View File

@ -10,7 +10,6 @@ FoamFile
version 2.0;
format ascii;
class volVectorField;
location "0";
object U;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -21,34 +20,28 @@ internalField uniform (0 0 0);
boundaryField
{
bottomWall
"bottomWall|topWall"
{
type fixedValue;
value uniform (0 0 0);
value $internalField;
}
topWall
{
type fixedValue;
value uniform (0 0 0);
}
left
{
type cyclic;
}
right
"left|right"
{
type cyclic;
}
inlet
{
value uniform (0 0 0);
value $internalField;
}
#include "inlet/U"
outlet
{
type inletOutlet;
inletValue uniform (0 0 0);
value uniform (0 0 0);
inletValue $internalField;
value $internalField;
}
}

View File

@ -16,12 +16,15 @@ FoamFile
inlet
{
type turbulentDigitalFilterInlet;
variant digitalFilter;
planeDivisions ( 64 70 );
L ( 0.78035508 0.31085352 0.342261 0.1728125 0.171875
0.22459375 0.172787596 0.171889998 0.224578995 );
patchNormalSpeed 20.133;
type turbulentDigitalFilterInlet;
n ( 64 70 );
L
(
0.78035508 0.31085352 0.342261 0.1728125 0.171875
0.22459375 0.172787596 0.171889998 0.224578995
);
Ubulk 20.133;
}
// ************************************************************************* //

View File

@ -22,4 +22,5 @@ inlet
mapMethod nearestCell;
}
// ************************************************************************* //

View File

@ -16,12 +16,16 @@ FoamFile
inlet
{
type turbulentDigitalFilterInlet;
variant reducedDigitalFilter;
planeDivisions ( 64 70 );
L ( 0.78035508 0.31085352 0.342261 0.1728125 0.171875
0.22459375 0.172787596 0.171889998 0.224578995 );
patchNormalSpeed 20.133;
type turbulentDigitalFilterInlet;
fsm true;
n ( 64 70 );
L
(
0.78035508 0.31085352 0.342261 0.1728125 0.171875
0.22459375 0.172787596 0.171889998 0.224578995
);
Ubulk 20.133;
}
// ************************************************************************* //

View File

@ -10,7 +10,6 @@ FoamFile
version 2.0;
format ascii;
class volScalarField;
location "0";
object nut;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -21,28 +20,17 @@ internalField uniform 0;
boundaryField
{
bottomWall
"bottomWall|topWall"
{
type zeroGradient;
}
topWall
{
type zeroGradient;
}
left
"left|right"
{
type cyclic;
}
right
{
type cyclic;
}
inlet
{
type calculated;
value uniform 1e-08;
}
outlet
"inlet|outlet"
{
type calculated;
value uniform 1e-08;

View File

@ -10,7 +10,6 @@ FoamFile
version 2.0;
format ascii;
class volScalarField;
location "0";
object p;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -21,30 +20,20 @@ internalField uniform 0;
boundaryField
{
bottomWall
"bottomWall|topWall|inlet"
{
type zeroGradient;
}
topWall
{
type zeroGradient;
}
left
"left|right"
{
type cyclic;
}
right
{
type cyclic;
}
inlet
{
type zeroGradient;
}
outlet
{
type fixedValue;
value uniform 0;
value $internalField;
}
}

View File

@ -4,6 +4,11 @@ cd "${0%/*}" || exit # Run from this directory
#------------------------------------------------------------------------------
cleanCase0
\rm -rf system/controlDict constant/boundaryData/inlet results
rm -f system/controlDict
rm -rf constant/boundaryData/inlet
rm -rf results
rm -f *.png
rm -f constant/{R*,points*,UMean*}
#------------------------------------------------------------------------------

View File

@ -4,15 +4,6 @@ cd "${0%/*}" || exit # Run from this directory
. ${WM_PROJECT_DIR:?}/bin/tools/CleanFunctions # Tutorial clean functions
#------------------------------------------------------------------------------
endTime=10
\cp system/controlDict.template system/controlDict
if notTest "$@"
then
endTime=85
fi
\sed -i "s|END_TIME|$endTime|g" system/controlDict
# Collect data into the 'results' directory,
# and clean the case for the next run
#
@ -20,14 +11,15 @@ fi
# ----
collectData(){
model=$1
\echo " Moving results into 'results/$model'"
results="results/$model"
\mkdir -p "$results"
runType=$2
echo " Moving results into 'results/$model.$runType'"
results="results/$model.$runType"
mkdir -p "$results"
timeDir=$(foamListTimes -latestTime)
\mv -f log* *.png postProcessing "$timeDir" "$results" 2>/dev/null
mv -f log* *.png postProcessing "$timeDir" "$results" 2>/dev/null
cleanTimeDirectories
\rm -rf processor* > /dev/null 2>&1
rm -rf processor* > /dev/null 2>&1
}
@ -40,13 +32,13 @@ serialRun(){
models=$*
for model in $models
do
\echo " Running with the synthetic turbulence model: $model"
(\cd 0 && \ln -snf "inlet.$model" inlet)
(\cd constant/boundaryData && \ln -snf "inlet.$model" inlet)
echo " Running with the synthetic turbulence model: $model"
(cd 0 && ln -snf "inlet.$model" inlet)
(cd constant/boundaryData && ln -snf "inlet.$model" inlet)
runApplication -s "$model" $(getApplication)
./plot
collectData $model
collectData $model "serial"
done
}
@ -60,36 +52,35 @@ parallelRun(){
models=$*
for model in $models
do
\echo " Running with the synthetic turbulence model: $model"
(\cd 0 && \ln -snf "inlet.$model" inlet)
(\cd constant/boundaryData && \ln -snf "inlet.$model" inlet)
echo " Running with the synthetic turbulence model: $model"
(cd 0 && ln -snf "inlet.$model" inlet)
(cd constant/boundaryData && ln -snf "inlet.$model" inlet)
runApplication -s "$model" decomposePar
runApplication -s "$model" decomposePar -force
runParallel -s "$model" $(getApplication)
runApplication -s "$model" reconstructPar -latestTime
./plot
collectData $model
collectData $model "parallel"
done
}
#------------------------------------------------------------------------------
# Synthetic inflow models
# Prepare the numerical setup
./Allrun.pre
# Run with the synthetic turbulence models
models="
reducedDigitalFilter
digitalFilter
FSM
DFM
DFSEM
"
# Prepare the numerical setup
runApplication blockMesh
restore0Dir
\rm -rf "results"
parallelRun $models
# Run with the synthetic turbulence models
serialRun $models
#parallelRun $models
#------------------------------------------------------------------------------

View File

@ -0,0 +1,20 @@
#!/bin/sh
cd "${0%/*}" || exit # Run from this directory
. ${WM_PROJECT_DIR:?}/bin/tools/RunFunctions # Tutorial run functions
#------------------------------------------------------------------------------
endTime=85
if notTest "$@"
then
endTime=10
fi
sed "s|END_TIME|$endTime|g" system/controlDict.template > system/controlDict
restore0Dir
runApplication blockMesh
rm -rf results
#------------------------------------------------------------------------------

View File

@ -1,12 +1,11 @@
Synthetic turbulence inflow tests
======================
#------------------------------------------------------------------------------
The following three synthetic turbulence inflow boundary conditions are
examined through a single-cell-domain smooth-wall plane channel flow setup:
- turbulentDFSEMInlet
- turbulentDigitalFilterInlet variant=digitalFilter
- turbulentDigitalFilterInlet variant=reducedDigitalFilter
- turbulentDFSEMInlet (DFSEM)
- turbulentDigitalFilterInlet (DFM)
- turbulentDigitalFilterInlet with the forward-stepwise method (FSM)
The input statistics are obtained from:
@ -22,13 +21,12 @@ The data is available online from (Retrieved: 21-06-2019):
https://turbulence.oden.utexas.edu/data/MKM/chan395/
Serial executing (comment out 'parallelRun'):
./Allrun
Parallel (decompositionMethod=scotch) executing (comment out 'serialRun'):
Executing:
./Allrun
The script will run the test case, and collect the plots and samples into
the 'results' directory.
#------------------------------------------------------------------------------

View File

@ -0,0 +1,135 @@
#!/bin/sh
cd "${0%/*}" || exit # Run from this directory
#------------------------------------------------------------------------------
plotCellR() {
timeDir=$1
echo " Plotting the normal and Reynolds stresses on cell."
outName="stress-cell.png"
gnuplot<<PLT_CELL_R
set terminal pngcairo font "helvetica,20" size 1000, 800
set xrange [0:1]
set yrange [-1:8]
set grid
set key top right
set key samplen 2
set key spacing 0.75
set xlabel "Channel height from the bottomWall [m]"
set ylabel "<u_i^' u_i^'> [m2/s2]"
set offset .05, .05
set output "$outName"
set title "Normal and Reynolds stresses on cell"
input = "$timeDir/inletCell_UPrime2Mean.xy"
bench = "constant/pointsRdata"
plot \
input u 1:2 t "<u^' u^'>" w l lw 2 lc rgb "#009E73", \
input u 1:5 t "<v^' v^'>" w l lw 2 lc rgb "#F0E440", \
input u 1:7 t "<w^' w^'>" w l lw 2 lc rgb "#0072B2", \
input u 1:3 t "<u^' v^'>" w l lw 2 lc rgb "#D55E00", \
bench u 2:4 t "<u^' u^'>_{DNS}" w l lw 2 dt 2 lc rgb "#009E73", \
bench u 2:7 t "<v^' v^'>_{DNS}" w l lw 2 dt 2 lc rgb "#F0E440", \
bench u 2:9 t "<w^' w^'>_{DNS}" w l lw 2 dt 2 lc rgb "#0072B2", \
bench u 2:5 t "<u^' v^'>_{DNS}" w l lw 2 dt 2 lc rgb "#D55E00"
PLT_CELL_R
}
plotPatchR() {
timeDir=$1
echo " Plotting the normal and Reynolds stresses on inlet patch faces."
outName="stress-patch.png"
gnuplot<<PLT_PATCH_R
set terminal pngcairo font "helvetica,20" size 1000, 800
set xrange [0:1]
set yrange [-1:8]
set grid
set key top right
set key samplen 2
set key spacing 0.75
set xlabel "Channel height from the bottomWall [m]"
set ylabel "<u_i^' u_i^'> [m2/s2]"
set offset .05, .05
set output "$outName"
set title "Normal and Reynolds stresses on patch"
input = "$timeDir/inletPatch_UPrime2Mean.xy"
bench = "constant/pointsRdata"
plot \
input u 1:2 t "<u^' u^'>" w l lw 2 lc rgb "#009E73", \
input u 1:5 t "<v^' v^'>" w l lw 2 lc rgb "#F0E440", \
input u 1:7 t "<w^' w^'>" w l lw 2 lc rgb "#0072B2", \
input u 1:3 t "<u^' v^'>" w l lw 2 lc rgb "#D55E00", \
bench u 2:4 t "<u^' u^'>_{DNS}" w l lw 2 dt 2 lc rgb "#009E73", \
bench u 2:7 t "<v^' v^'>_{DNS}" w l lw 2 dt 2 lc rgb "#F0E440", \
bench u 2:9 t "<w^' w^'>_{DNS}" w l lw 2 dt 2 lc rgb "#0072B2", \
bench u 2:5 t "<u^' v^'>_{DNS}" w l lw 2 dt 2 lc rgb "#D55E00"
PLT_PATCH_R
}
plotPatchUMean() {
timeDir=$1
echo " Plotting the streamwise mean flow speed on inlet patch faces."
outName="u-patch.png"
gnuplot<<PLT_PATCH_UMEAN
set terminal pngcairo font "helvetica,20" size 1000, 800
set xrange [0:1]
set yrange [0:25]
set grid
set key top right
set key samplen 2
set key spacing 0.75
set xlabel "Channel height from the bottomWall [m]"
set ylabel "u [m/s]"
set offset .05, .05
set output "$outName"
input = "$timeDir/inletPatch_UMean.xy"
bench = "constant/pointsUMeanData"
plot \
input u 1:2 t "u" w l lw 2 lc rgb "#009E73", \
bench u 2:4 t "u_{DNS}" w l lw 2 dt 2 lc rgb "#009E73"
PLT_PATCH_UMEAN
}
#------------------------------------------------------------------------------
# Require gnuplot
command -v gnuplot >/dev/null || {
echo "gnuplot not found - skipping graph creation" 1>&2
exit 1
}
# Prepare the benchmark data
cp -f constant/boundaryData/inlet/0/R constant/R
cp -f constant/boundaryData/inlet/points constant/points
cp -f constant/boundaryData/inlet.DFM/0/UMean constant/UMean
cat constant/R | tr -d '()' > constant/Rdata
cat constant/points | tr -d '()' > constant/pointsData
cat constant/UMean | tr -d '()' > constant/UMeanData
paste constant/pointsData constant/Rdata > constant/pointsRdata
paste constant/pointsData constant/UMeanData > constant/pointsUMeanData
# The latestTime in postProcessing/sampling1
timeDir=$(foamListTimes -case postProcessing/sampling1 -latestTime 2>/dev/null)
[ -n "$timeDir" ] || {
echo "No postProcessing/sampling1 found - skipping graph creation" 1>&2
exit 1
}
timeDir="postProcessing/sampling1/$timeDir"
plotCellR "$timeDir"
plotPatchR "$timeDir"
plotPatchUMean "$timeDir"
#------------------------------------------------------------------------------

View File

@ -88,4 +88,5 @@ mergePatchPairs
(
);
// ************************************************************************* //

View File

@ -29,7 +29,7 @@ deltaT 4e-3;
writeControl timeStep;
writeInterval 1250;
writeInterval 50;
purgeWrite 3;
@ -47,13 +47,59 @@ runTimeModifiable false;
adjustTimeStep false;
// Allow 10% of time for initialisation before sampling
timeStart #eval #{ 0.1 * ${/endTime} #};
functions
{
#include "fieldAverage"
#include "sampling"
fieldAverage1
{
type fieldAverage;
libs (fieldFunctionObjects);
writeControl writeTime;
timeStart $/timeStart;
fields
(
U
{
mean on;
prime2Mean on;
base time;
}
);
}
sampling1
{
type sets;
libs (sampling);
interpolationScheme cellPoint;
setFormat raw;
writeControl onEnd;
fields (UPrime2Mean UMean);
sets
(
inletPatch
{
type face;
axis y;
start (0.0 0 1.57);
end (0.0 2 1.57);
}
inletCell
{
type midPoint;
axis y;
start (0.062832 0 1.57);
end (0.062832 2 1.57);
}
);
}
}
// ************************************************************************* //

View File

@ -10,13 +10,19 @@ FoamFile
version 2.0;
format ascii;
class dictionary;
note "mesh decomposition control dictionary";
object decomposeParDict;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
numberOfSubdomains 3;
numberOfSubdomains 4;
method hierarchical;
coeffs
{
n (1 2 2);
}
method scotch;
// ************************************************************************* //

View File

@ -51,4 +51,5 @@ snGradSchemes
default corrected;
}
// ************************************************************************* //

View File

@ -1,73 +0,0 @@
#!/bin/sh
cd "${0%/*}" || exit # Run from this directory
#------------------------------------------------------------------------------
plotStresses() {
timeDir=$1
\echo " Plotting the normal and Reynolds stresses"
gnuplot<<PLT_STRESSES
set terminal pngcairo font "helvetica,20" size 1000, 800
set xrange [0:1]
set yrange [-1:8]
set grid
set key top right
set xlabel "Channel height from the bottomWall [m]"
set ylabel "<u_i^' u_i^'>"
set offset .05, .05
set style data linespoints
set linetype 1 lc rgb 'black' lw 2
set linetype 2 lc rgb 'red' lw 2
set linetype 3 lc rgb 'blue' lw 2
set linetype 4 lc rgb 'green' lw 2
set linetype 5 lc rgb 'black' pi -8 pt 4 ps 1.5
set linetype 6 lc rgb 'red' pi -8 pt 4 ps 1.5
set linetype 7 lc rgb 'blue' pi -8 pt 4 ps 1.5
set linetype 8 lc rgb 'green' pi -8 pt 4 ps 1.5
set title "Normal and Reynolds stresses on cell"
input="$timeDir/inletCell_UPrime2Mean.xy"
set output 'stress-cell.png'
plot \
input u 1:2 w lines t "<u^' u^'>" lt 1, \
input u 1:5 w lines t "<v^' v^'>" lt 2, \
input u 1:7 w lines t "<w^' w^'>" lt 3, \
input u 1:3 w lines t "<u^' v^'>" lt 4
set title "Normal and Reynolds stresses on patch"
input = "$timeDir/inletPatch_UPrime2Mean.xy"
set output 'stress-patch.png'
plot \
input u 1:2 w lines t "<u^' u^'>" lt 1, \
input u 1:5 w lines t "<v^' v^'>" lt 2, \
input u 1:7 w lines t "<w^' w^'>" lt 3, \
input u 1:3 w lines t "<u^' v^'>" lt 4
PLT_STRESSES
}
#------------------------------------------------------------------------------
# Require gnuplot
command -v gnuplot >/dev/null || {
\echo "gnuplot not found - skipping graph creation" 1>&2
\exit 1
}
# The latestTime in postProcessing/inletSampling
timeDir=$(foamListTimes -case postProcessing/inletSampling -latestTime 2>/dev/null)
[ -n "$timeDir" ] || {
\echo "No postProcessing/inletSampling found - skipping graph creation" 1>&2
\exit 2
}
timeDir="postProcessing/inletSampling/$timeDir"
plotStresses "$timeDir"
#------------------------------------------------------------------------------

View File

@ -1,36 +0,0 @@
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: v1912 |
| \\ / A nd | Website: www.openfoam.com |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class dictionary;
location "system";
object fieldAverage;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
fieldAverage1
{
type fieldAverage;
libs (fieldFunctionObjects);
writeControl writeTime;
timeStart $/timeStart;
fields
(
U
{
mean on;
prime2Mean on;
base time;
}
);
}
// ************************************************************************* //

View File

@ -1,48 +0,0 @@
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: v1912 |
| \\ / A nd | Website: www.openfoam.com |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class dictionary;
location "system";
object sampling;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
inletSampling
{
type sets;
libs (sampling);
writeControl writeTime;
timeStart $/timeStart;
interpolationScheme cellPoint;
setFormat raw;
fields (UPrime2Mean);
sets
(
inletPatch
{
type face;
axis y;
start (0.0 0 1.57);
end (0.0 2 1.57);
}
inletCell
{
type midPoint;
axis y;
start (0.062832 0 1.57);
end (0.062832 2 1.57);
}
);
}
// ************************************************************************* //