TUT: generalize scripts for turbulentInflow

This commit is contained in:
Mark Olesen
2019-06-24 12:29:19 +02:00
committed by Andrew Heather
parent 9b0ff60320
commit 49864ba7d7
15 changed files with 277 additions and 288 deletions

View File

@ -41,12 +41,9 @@ boundaryField
} }
inlet inlet
{ {
type turbulentDFSEMInlet;
delta 2;
nCellPerEddy 1;
mapMethod nearestCell;
value uniform (0 0 0); value uniform (0 0 0);
} }
#include "inlet/U"
outlet outlet
{ {
type inletOutlet; type inletOutlet;

View File

@ -1,61 +0,0 @@
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: v1906 |
| \\ / A nd | Web: www.OpenFOAM.com |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class volVectorField;
location "0";
object U;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
dimensions [0 1 -1 0 0 0 0];
internalField uniform (0 0 0);
boundaryField
{
bottomWall
{
type fixedValue;
value uniform (0 0 0);
}
topWall
{
type fixedValue;
value uniform (0 0 0);
}
sides_half0
{
type cyclic;
}
sides_half1
{
type cyclic;
}
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;
value uniform (0 0 0);
}
outlet
{
type inletOutlet;
inletValue uniform (0 0 0);
value uniform (0 0 0);
}
}
// ************************************************************************* //

View File

@ -1,61 +0,0 @@
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: v1906 |
| \\ / A nd | Web: www.OpenFOAM.com |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class volVectorField;
location "0";
object U;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
dimensions [0 1 -1 0 0 0 0];
internalField uniform (0 0 0);
boundaryField
{
bottomWall
{
type fixedValue;
value uniform (0 0 0);
}
topWall
{
type fixedValue;
value uniform (0 0 0);
}
sides_half0
{
type cyclic;
}
sides_half1
{
type cyclic;
}
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;
value uniform (0 0 0);
}
outlet
{
type inletOutlet;
inletValue uniform (0 0 0);
value uniform (0 0 0);
}
}
// ************************************************************************* //

View File

@ -0,0 +1,25 @@
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: v1906 |
| \\ / A nd | Web: www.OpenFOAM.com |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class volVectorField;
object U;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
inlet
{
type turbulentDFSEMInlet;
delta 2;
nCellPerEddy 1;
mapMethod nearestCell;
}
// ************************************************************************* //

View File

@ -0,0 +1,27 @@
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: v1906 |
| \\ / A nd | Web: www.OpenFOAM.com |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class volVectorField;
object U;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
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;
}
// ************************************************************************* //

View File

@ -0,0 +1,27 @@
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: v1906 |
| \\ / A nd | Web: www.OpenFOAM.com |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class volVectorField;
object U;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
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;
}
// ************************************************************************* //

View File

@ -1,8 +1,9 @@
#!/bin/sh #!/bin/sh
cd ${0%/*} || exit 1 # Run from this directory
cd ${0%/*} || exit 1 # run from this directory
. $WM_PROJECT_DIR/bin/tools/CleanFunctions # Tutorial clean functions . $WM_PROJECT_DIR/bin/tools/CleanFunctions # Tutorial clean functions
cleanCase0 cleanCase0
\rm -rf results \rm -rf constant/boundaryData/inlet 2>/dev/null
\rm -rf results 2>/dev/null
#------------------------------------------------------------------------------

View File

@ -1,34 +1,33 @@
#!/bin/sh #!/bin/sh
cd ${0%/*} || exit 1 # Run from this directory
cd ${0%/*} || exit 1 # run from this directory . $WM_PROJECT_DIR/bin/tools/RunFunctions # Tutorial run functions
. $WM_PROJECT_DIR/bin/tools/RunFunctions # Tutorial run functions
. $WM_PROJECT_DIR/bin/tools/CleanFunctions # Tutorial clean functions . $WM_PROJECT_DIR/bin/tools/CleanFunctions # Tutorial clean functions
# Compute test case with different synthetic inflow models # Test with different synthetic inflow models
declare -a Models=( modelTypes="reducedDigitalFilter digitalFilter DFSEM"
"reducedDigitalFilter"
"digitalFilter"
"DFSEM"
)
# Collect data in 'results' directory
[ -d "results" ] || mkdir results
restore0Dir
runApplication blockMesh runApplication blockMesh
restore0Dir
# Compute and collect data # Compute (serial) and collect data
for val in ${Models[@]}; do for modelType in $modelTypes
echo "Running the case with the model: $val" do
\cp 0/U.$val 0/U echo
\rm -rf constant/boundaryData/inlet echo "Running with model: $modelType"
\cp -r constant/boundaryData/inlet.$val constant/boundaryData/inlet (cd 0 && ln -sf "inlet.$modelType" inlet)
runApplication pimpleFoam (cd constant/boundaryData && ln -sf "inlet.$modelType" inlet)
gnuplot plot.patch
gnuplot plot.cell runApplication -s "$modelType" pimpleFoam
mv postProcessing results/postProcessing.$val ./createGraphs
mv stress* results/postProcessing.$val/.
mv log* results/postProcessing.$val/. # Collect data in 'results' directory
cleanTimeDirectories results="results/$modelType"
echo "Placing summary in $results"
mkdir -p "$results"
mv -f log.* *.png postProcessing "$results" 2>/dev/null
cleanTimeDirectories
\rm -rf processor* >/dev/null 2>&1
done done
#------------------------------------------------------------------------------

View File

@ -1,36 +1,34 @@
#!/bin/sh #!/bin/sh
cd ${0%/*} || exit 1 # Run from this directory
cd ${0%/*} || exit 1 # run from this directory . $WM_PROJECT_DIR/bin/tools/RunFunctions # Tutorial run functions
. $WM_PROJECT_DIR/bin/tools/RunFunctions # Tutorial run functions
. $WM_PROJECT_DIR/bin/tools/CleanFunctions # Tutorial clean functions . $WM_PROJECT_DIR/bin/tools/CleanFunctions # Tutorial clean functions
# Compute test case with different synthetic inflow models # Test with different synthetic inflow models
declare -a Models=( modelTypes="reducedDigitalFilter digitalFilter DFSEM"
"reducedDigitalFilter"
"digitalFilter"
"DFSEM"
)
# Collect data in 'results' directory
[ -d "results" ] || mkdir results
restore0Dir
runApplication blockMesh runApplication blockMesh
restore0Dir
# Compute parallel and collect data # Compute (parallel) and collect data
for val in ${Models[@]}; do for modelType in $modelTypes
echo "Running the case with the model: $val" do
\rm -f 0/U* echo
\cp 0.orig/U.$val 0/U echo "Running with model: $modelType"
\rm -rf constant/boundaryData/inlet (cd 0 && ln -sf "inlet.$modelType" inlet)
\cp -r constant/boundaryData/inlet.$val constant/boundaryData/inlet (cd constant/boundaryData && ln -sf "inlet.$modelType" inlet)
runApplication decomposePar
runParallel pimpleFoam runApplication -s "$modelType" decomposePar
gnuplot plot.patch runParallel -s "$modelType" pimpleFoam
gnuplot plot.cell ./createGraphs
mv postProcessing results/postProcessing.$val
mv stress* results/postProcessing.$val/. # Collect data in 'results' directory
mv log* results/postProcessing.$val/. results="results/$modelType"
cleanTimeDirectories echo "Placing summary in $results"
\rm -rf processor* > /dev/null 2>&1 mkdir -p "$results"
mv -f log.* *.png postProcessing "$results" 2>/dev/null
cleanTimeDirectories
\rm -rf processor* >/dev/null 2>&1
done done
#------------------------------------------------------------------------------

View File

@ -0,0 +1,67 @@
#!/bin/sh
cd ${0%/*} || exit 1 # Run from this directory
# Require gnuplot
command -v gnuplot >/dev/null 2>&1 || {
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"
echo "Creating graphs"
gnuplot<<GNUPLOT
set terminal png size 1000,800 enhanced font "Helvetica,24"
set xrange [0:1]
set yrange [-1:8]
set xlabel "Channel height"
set ylabel "<u_i u_i>"
set offset .05, .05
set style data linespoints
set grid
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 "Stress in cell"
input = "$timeDir/inletCell_UPrime2Mean.xy"
set output 'stress-cell.png'
plot \
input u 1:2 w lines t "<uu>" lt 1, \
input u 1:5 w lines t "<vv>" lt 2, \
input u 1:7 w lines t "<ww>" lt 3, \
input u 1:3 w lines t "<uv>" lt 4
set title "Stress on patch"
input = "$timeDir/inletPatch_UPrime2Mean.xy"
set output 'stress-patch.png'
plot \
input u 1:2 w lines t "<uu>" lt 1, \
input u 1:5 w lines t "<vv>" lt 2, \
input u 1:7 w lines t "<ww>" lt 3, \
input u 1:3 w lines t "<uv>" lt 4
GNUPLOT
#------------------------------------------------------------------------------

View File

@ -1,26 +0,0 @@
set terminal png size 1000,800 enhanced font "Helvetica,24"
set output 'stress-cell.png'
set xrange [0:1]
set yrange [-1:8]
set xlabel "Channel height"
set ylabel "<u_i u_i>"
set offset .05, .05
set style data linespoints
set grid
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
plot \
"postProcessing/inletSampling/85/inletCell_UPrime2Mean.xy" u 1:2 w lines t "<uu>" lt 1, \
"postProcessing/inletSampling/85/inletCell_UPrime2Mean.xy" u 1:5 w lines t "<vv>" lt 2, \
"postProcessing/inletSampling/85/inletCell_UPrime2Mean.xy" u 1:7 w lines t "<ww>" lt 3, \
"postProcessing/inletSampling/85/inletCell_UPrime2Mean.xy" u 1:3 w lines t "<uv>" lt 4

View File

@ -1,26 +0,0 @@
set terminal png size 1000,800 enhanced font "Helvetica,24"
set output 'stress-patch.png'
set xrange [0:1]
set yrange [-1:8]
set xlabel "Channel height"
set ylabel "<u_i u_i>"
set offset .05, .05
set style data linespoints
set grid
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
plot \
"postProcessing/inletSampling/85/inletPatch_UPrime2Mean.xy" u 1:2 w lines t "<uu>" lt 1, \
"postProcessing/inletSampling/85/inletPatch_UPrime2Mean.xy" u 1:5 w lines t "<vv>" lt 2, \
"postProcessing/inletSampling/85/inletPatch_UPrime2Mean.xy" u 1:7 w lines t "<ww>" lt 3, \
"postProcessing/inletSampling/85/inletPatch_UPrime2Mean.xy" u 1:3 w lines t "<uv>" lt 4

View File

@ -45,59 +45,14 @@ timePrecision 8;
runTimeModifiable false; runTimeModifiable false;
adjustTimeStep false; adjustTimeStep false;
// Allow 10% run-up before calculating mean
timeStart #calc #{ 0.1 * ${/endTime} #};
functions functions
{ {
fieldAverage1 #include "sampling"
{
type fieldAverage;
libs ("libfieldFunctionObjects.so");
enabled true;
writeControl writeTime;
timeStart 8.5;
restartOnRestart false;
fields
(
U
{
mean on;
prime2Mean on;
base time;
}
);
}
inletSampling
{
type sets;
libs ("libsampling.so");
enabled true;
writeControl writeTime;
timeStart 8.5;
restartOnRestart false;
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 face;
axis y;
start (0.062832 0 1.57);
end (0.062832 2 1.57);
}
);
}
} }
// ************************************************************************* // // ************************************************************************* //

View File

@ -17,6 +17,6 @@ FoamFile
numberOfSubdomains 6; numberOfSubdomains 6;
method scotch; method scotch;
// ************************************************************************* // // ************************************************************************* //

View File

@ -0,0 +1,67 @@
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: v1906 |
| \\ / A nd | Web: www.OpenFOAM.com |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class dictionary;
location "system";
object sampling;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
fieldAverage1
{
type fieldAverage;
libs ("libfieldFunctionObjects.so");
writeControl writeTime;
timeStart ${/timeStart};
fields
(
U
{
mean on;
prime2Mean on;
base time;
}
);
}
inletSampling
{
type sets;
libs ("libsampling.so");
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 face;
axis y;
start (0.062832 0 1.57);
end (0.062832 2 1.57);
}
);
}
// ************************************************************************* //