Commit 49864ba7 authored by Mark Olesen's avatar Mark Olesen Committed by Andrew Heather
Browse files

TUT: generalize scripts for turbulentInflow

parent 9b0ff603
......@@ -41,12 +41,9 @@ boundaryField
}
inlet
{
type turbulentDFSEMInlet;
delta 2;
nCellPerEddy 1;
mapMethod nearestCell;
value uniform (0 0 0);
}
#include "inlet/U"
outlet
{
type inletOutlet;
......
......@@ -10,52 +10,16 @@ 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
inlet
{
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);
}
type turbulentDFSEMInlet;
delta 2;
nCellPerEddy 1;
mapMethod nearestCell;
}
// ************************************************************************* //
......@@ -10,52 +10,18 @@ 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
inlet
{
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);
}
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;
}
// ************************************************************************* //
/*--------------------------------*- 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;
}
// ************************************************************************* //
#!/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
cleanCase0
\rm -rf results
\rm -rf constant/boundaryData/inlet 2>/dev/null
\rm -rf results 2>/dev/null
#------------------------------------------------------------------------------
#!/bin/sh
cd ${0%/*} || exit 1 # run from this directory
. $WM_PROJECT_DIR/bin/tools/RunFunctions # Tutorial run functions
cd ${0%/*} || exit 1 # Run from this directory
. $WM_PROJECT_DIR/bin/tools/RunFunctions # Tutorial run functions
. $WM_PROJECT_DIR/bin/tools/CleanFunctions # Tutorial clean functions
# Compute test case with different synthetic inflow models
declare -a Models=(
"reducedDigitalFilter"
"digitalFilter"
"DFSEM"
)
# Test with different synthetic inflow models
modelTypes="reducedDigitalFilter digitalFilter DFSEM"
# Collect data in 'results' directory
[ -d "results" ] || mkdir results
restore0Dir
runApplication blockMesh
restore0Dir
# Compute (serial) and collect data
for modelType in $modelTypes
do
echo
echo "Running with model: $modelType"
(cd 0 && ln -sf "inlet.$modelType" inlet)
(cd constant/boundaryData && ln -sf "inlet.$modelType" inlet)
runApplication -s "$modelType" pimpleFoam
./createGraphs
# Collect data in 'results' directory
results="results/$modelType"
echo "Placing summary in $results"
mkdir -p "$results"
mv -f log.* *.png postProcessing "$results" 2>/dev/null
# Compute and collect data
for val in ${Models[@]}; do
echo "Running the case with the model: $val"
\cp 0/U.$val 0/U
\rm -rf constant/boundaryData/inlet
\cp -r constant/boundaryData/inlet.$val constant/boundaryData/inlet
runApplication pimpleFoam
gnuplot plot.patch
gnuplot plot.cell
mv postProcessing results/postProcessing.$val
mv stress* results/postProcessing.$val/.
mv log* results/postProcessing.$val/.
cleanTimeDirectories
cleanTimeDirectories
\rm -rf processor* >/dev/null 2>&1
done
#------------------------------------------------------------------------------
#!/bin/sh
cd ${0%/*} || exit 1 # run from this directory
. $WM_PROJECT_DIR/bin/tools/RunFunctions # Tutorial run functions
cd ${0%/*} || exit 1 # Run from this directory
. $WM_PROJECT_DIR/bin/tools/RunFunctions # Tutorial run functions
. $WM_PROJECT_DIR/bin/tools/CleanFunctions # Tutorial clean functions
# Compute test case with different synthetic inflow models
declare -a Models=(
"reducedDigitalFilter"
"digitalFilter"
"DFSEM"
)
# Test with different synthetic inflow models
modelTypes="reducedDigitalFilter digitalFilter DFSEM"
# Collect data in 'results' directory
[ -d "results" ] || mkdir results
restore0Dir
runApplication blockMesh
restore0Dir
# Compute parallel and collect data
for val in ${Models[@]}; do
echo "Running the case with the model: $val"
\rm -f 0/U*
\cp 0.orig/U.$val 0/U
\rm -rf constant/boundaryData/inlet
\cp -r constant/boundaryData/inlet.$val constant/boundaryData/inlet
runApplication decomposePar
runParallel pimpleFoam
gnuplot plot.patch
gnuplot plot.cell
mv postProcessing results/postProcessing.$val
mv stress* results/postProcessing.$val/.
mv log* results/postProcessing.$val/.
cleanTimeDirectories
\rm -rf processor* > /dev/null 2>&1
# Compute (parallel) and collect data
for modelType in $modelTypes
do
echo
echo "Running with model: $modelType"
(cd 0 && ln -sf "inlet.$modelType" inlet)
(cd constant/boundaryData && ln -sf "inlet.$modelType" inlet)
runApplication -s "$modelType" decomposePar
runParallel -s "$modelType" pimpleFoam
./createGraphs
# Collect data in 'results' directory
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
#------------------------------------------------------------------------------
#!/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 output 'stress-patch.png'
set xrange [0:1]
set yrange [-1:8]
......@@ -19,8 +42,26 @@ 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 \
"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
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
#------------------------------------------------------------------------------
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
......@@ -45,59 +45,14 @@ timePrecision 8;
runTimeModifiable false;
adjustTimeStep false;
adjustTimeStep false;
// Allow 10% run-up before calculating mean
timeStart #calc #{ 0.1 * ${/endTime} #};
functions
{
fieldAverage1
{
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);
}
);
}
#include "sampling"
}
// ************************************************************************* //
......@@ -17,6 +17,6 @@ FoamFile
numberOfSubdomains 6;
method scotch;
method scotch;
// ************************************************************************* //
/*--------------------------------*- 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);
}
);
}
// ************************************************************************* //
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment