Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Development
OpenFOAM-plus
Commits
d7a768fc
Commit
d7a768fc
authored
Jun 24, 2019
by
Mark OLESEN
Browse files
TUT: generalize scripts for turbulentInflow
parent
2c8989b6
Changes
12
Hide whitespace changes
Inline
Side-by-side
tutorials/verificationAndValidation/turbulentInflow/0.orig/U
.DFSEM
→
tutorials/verificationAndValidation/turbulentInflow/0.orig/U
View file @
d7a768fc
...
...
@@ -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;
...
...
tutorials/verificationAndValidation/turbulentInflow/0.orig/
U.digitalFilter
→
tutorials/verificationAndValidation/turbulentInflow/0.orig/
inlet.DFSEM/U
View file @
d7a768fc
...
...
@@ -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;
}
// ************************************************************************* //
tutorials/verificationAndValidation/turbulentInflow/0.orig/
U.reducedD
igitalFilter
→
tutorials/verificationAndValidation/turbulentInflow/0.orig/
inlet.d
igitalFilter
/U
View file @
d7a768fc
...
...
@@ -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;
}
// ************************************************************************* //
tutorials/verificationAndValidation/turbulentInflow/0.orig/inlet.reducedDigitalFilter/U
0 → 100644
View file @
d7a768fc
/*--------------------------------*- 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;
}
// ************************************************************************* //
tutorials/verificationAndValidation/turbulentInflow/Allclean
View file @
d7a768fc
#!/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
\r
m
-rf
results
\r
m
-rf
constant/boundaryData/inlet 2>/dev/null
\r
m
-rf
results 2>/dev/null
#------------------------------------------------------------------------------
tutorials/verificationAndValidation/turbulentInflow/Allrun
View file @
d7a768fc
#!/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
"
\c
p 0/U.
$val
0/U
\r
m
-rf
constant/boundaryData/inlet
\c
p
-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
\r
m
-rf
processor
*
>
/dev/null 2>&1
done
#------------------------------------------------------------------------------
tutorials/verificationAndValidation/turbulentInflow/Allrun-parallel
View file @
d7a768fc
#!/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
"
\r
m
-f
0/U
*
\c
p 0.orig/U.
$val
0/U
\r
m
-rf
constant/boundaryData/inlet
\c
p
-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
\r
m
-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
\r
m
-rf
processor
*
>
/dev/null 2>&1
done
#------------------------------------------------------------------------------
tutorials/verificationAndValidation/turbulentInflow/
plot.patch
→
tutorials/verificationAndValidation/turbulentInflow/
createGraphs
View file @
d7a768fc
#!/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
#------------------------------------------------------------------------------
tutorials/verificationAndValidation/turbulentInflow/plot.cell
deleted
100755 → 0
View file @
2c8989b6
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
tutorials/verificationAndValidation/turbulentInflow/system/controlDict
View file @
d7a768fc
...
...
@@ -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"
}
// ************************************************************************* //
tutorials/verificationAndValidation/turbulentInflow/system/decomposeParDict
View file @
d7a768fc
...
...
@@ -17,6 +17,6 @@ FoamFile
numberOfSubdomains 6;
method scotch;
method
scotch;
// ************************************************************************* //
tutorials/verificationAndValidation/turbulentInflow/system/sampling
0 → 100644
View file @
d7a768fc
/*--------------------------------*- 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);
}
);
}
// ************************************************************************* //
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment