TUT: Added new tutorial cases

This commit is contained in:
Andrew Heather 2018-06-22 15:25:06 +01:00
parent abb597359f
commit 598c49fe8a
76 changed files with 4100 additions and 0 deletions

View File

@ -0,0 +1,6 @@
#!/bin/sh
cd ${0%/*} || exit 1 # run from this directory
(cd initChannel && ./Allclean)
(cd fullCase && ./Allclean)

View File

@ -0,0 +1,11 @@
#!/bin/sh
cd ${0%/*} || exit 1 # run from this directory
# Run a precursor channel flow to create a fully developed flow profile for the
# main case
(cd initChannel && ./Allrun)
# Run the main case
(cd fullCase && ./Allrun)

View File

@ -0,0 +1,17 @@
Unsteady flow over a surface mounted cube
The set-up is based on the description given by Martinuzzi and Tropea:
R. Martinuzzi and C. Tropea. The Flow Around Surface-Mounted, Prismatic
Obstacles Placed in a Fully Developed Channel Flow. Journal of Fluids
Engineering, 115(1):85-92, 1993.
where the Reynolds number based on the cube height is Re_h 40000.
Turbulence is modelled using the Spalart-Allmaras Improved Delayed Detached
Eddy Simulation (IDDES) model
For further details please visit:
openfoam.com/documentation/cpp-guide/html/verification-validation-turbulent-surface-mounted-cube.html

View File

@ -0,0 +1,55 @@
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: plus |
| \\ / 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
{
inlet
{
// type timeVaryingMappedFixedValue;
// offset (0 0 0);
// setAverage off;
type turbulentDFSEMInlet;
delta 1;
nCellPerEddy 3;
mapMethod nearestCell;
value $internalField;
}
outlet
{
type inletOutlet;
inletValue uniform (0 0 0);
value uniform (0 0 0);
}
sides
{
type slip;
}
"(cube|topAndBottom)"
{
type noSlip;
}
}
// ************************************************************************* //

View File

@ -0,0 +1,52 @@
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: plus |
| \\ / A nd | Web: www.OpenFOAM.com |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class volScalarField;
location "0";
object k;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
dimensions [0 2 -2 0 0 0 0];
internalField uniform 1e-5;
boundaryField
{
inlet
{
type timeVaryingMappedFixedValue;
offset 0;
setAverage off;
mapMethod nearest;
// type fixedValue;
value $internalField;
}
outlet
{
type zeroGradient;
}
sides
{
type zeroGradient;
}
"(cube|topAndBottom)"
{
type fixedValue;
value uniform 0;
}
}
// ************************************************************************* //

View File

@ -0,0 +1,52 @@
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: plus |
| \\ / A nd | Web: www.OpenFOAM.com |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class volScalarField;
location "0";
object nuTilda;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
dimensions [0 2 -1 0 0 0 0];
internalField uniform 7.5e-5;
boundaryField
{
inlet
{
type timeVaryingMappedFixedValue;
offset 0;
setAverage off;
mapMethod nearest;
// type fixedValue;
value $internalField;
}
outlet
{
type zeroGradient;
}
sides
{
type zeroGradient;
}
"(cube|topAndBottom)"
{
type fixedValue;
value uniform 0;
}
}
// ************************************************************************* //

View File

@ -0,0 +1,49 @@
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: plus |
| \\ / A nd | Web: www.OpenFOAM.com |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class volScalarField;
location "0";
object nut;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
dimensions [0 2 -1 0 0 0 0];
internalField uniform 0;
boundaryField
{
inlet
{
type calculated;
value $internalField;
}
outlet
{
type calculated;
value $internalField;
}
sides
{
type zeroGradient;
}
"(cube|topAndBottom)"
{
type nutUSpaldingWallFunction;
value $internalField;
}
}
// ************************************************************************* //

View File

@ -0,0 +1,47 @@
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: plus |
| \\ / A nd | Web: www.OpenFOAM.com |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class volScalarField;
location "0";
object p;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
dimensions [0 2 -2 0 0 0 0];
internalField uniform 0;
boundaryField
{
inlet
{
type zeroGradient;
}
outlet
{
type fixedValue;
value uniform 0;
}
sides
{
type zeroGradient;
}
"(cube|topAndBottom)"
{
type zeroGradient;
}
}
// ************************************************************************* //

View File

@ -0,0 +1,9 @@
#!/bin/sh
cd ${0%/*} || exit 1 # run from this directory
# Source tutorial clean functions
. $WM_PROJECT_DIR/bin/tools/CleanFunctions
cleanCase
\rm -rf constant/boundaryData *.png

View File

@ -0,0 +1,29 @@
#!/bin/sh
cd ${0%/*} || exit 1 # run from this directory
# Source tutorial run functions
. $WM_PROJECT_DIR/bin/tools/RunFunctions
channelCase=../initChannel
channelDataDir=$channelCase/postProcessing/surfaces/inlet
[ -d $channelDataDir ] || {
echo "Unable to locate precursor channel case - exiting"
exit 1
}
# Copy the channel data
# Note: this is mapped using a timeVaryingMapped condition on the inlet patch
mkdir -p constant/boundaryData/inlet/0
channelTimeDir=$(foamListTimes -case $channelCase -latestTime)
\cp -rf $channelDataDir/points constant/boundaryData/inlet
\cp -rf $channelDataDir/$channelTimeDir/turbulenceProperties:R constant/boundaryData/inlet/0/R
\cp -rf $channelDataDir/$channelTimeDir/turbulenceProperties:L constant/boundaryData/inlet/0/L
\cp -rf $channelDataDir/$channelTimeDir/turbulenceProperties:nuTilda constant/boundaryData/inlet/0/nuTilda
\cp -rf $channelDataDir/$channelTimeDir/U constant/boundaryData/inlet/0/U
runApplication blockMesh
runApplication decomposePar
runParallel $(getApplication)

View File

@ -0,0 +1,23 @@
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: plus |
| \\ / A nd | Web: www.OpenFOAM.com |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class dictionary;
location "constant";
object transportProperties;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
transportModel Newtonian;
nu 2.5e-05;
// ************************************************************************* //

View File

@ -0,0 +1,40 @@
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: plus |
| \\ / A nd | Web: www.OpenFOAM.com |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class dictionary;
object RASProperties;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
simulationType LES;
LES
{
turbulence on;
LESModel SpalartAllmarasIDDES;
printCoeffs on;
delta IDDESDelta;
IDDESDeltaCoeffs
{
hmax maxDeltaxyzCubeRoot;
maxDeltaxyzCubeRootCoeffs
{
}
}
}
// ************************************************************************* //

View File

@ -0,0 +1,52 @@
#!/bin/sh
cd ${0%/*} || exit 1 # run from this directory
time=$1
gnuplot<<EOF
set terminal pngcairo font "arial,16" size 600,600
set xlabel "U/U_b"
set ylabel "y/H"
set grid
set key right top
set xrange [-0.5:1.5]
set yrange [0:2]
Ub=1.10763
set output "U_at_x_by_hm10.png"
plot \
"postProcessing/sample/$time/xm10_U_UMean.xy" u (\$5/Ub):1 title "X/h = -1" w lines lc "black" lw 2
set output "U_at_x_by_hm05.png"
plot \
"postProcessing/sample/$time/xm05_U_UMean.xy" u (\$5/Ub):1 title "X/h = -0.5" w lines lc "black" lw 2
set output "U_at_x_by_00.png"
plot \
"postProcessing/sample/$time/x00_U_UMean.xy" u (\$5/Ub):1 title "X/h = 0" w lines lc "black" lw 2
set output "U_at_x_by_05.png"
plot \
"postProcessing/sample/$time/x05_U_UMean.xy" u (\$5/Ub):1 title "X/h = 0.5" w lines lc "black" lw 2
set output "U_at_x_by_10.png"
plot \
"postProcessing/sample/$time/x10_U_UMean.xy" u (\$5/Ub):1 title "X/h = 1" w lines lc "black" lw 2
set output "U_at_x_by_15.png"
plot \
"postProcessing/sample/$time/x15_U_UMean.xy" u (\$5/Ub):1 title "X/h = 1.5" w lines lc "black" lw 2
set output "U_at_x_by_20.png"
plot \
"postProcessing/sample/$time/x20_U_UMean.xy" u (\$5/Ub):1 title "X/h = 2" w lines lc "black" lw 2
set output "U_at_x_by_25.png"
plot \
"postProcessing/sample/$time/x25_U_UMean.xy" u (\$5/Ub):1 title "X/h = 2.5" w lines lc "black" lw 2
set output "U_at_x_by_30.png"
plot \
"postProcessing/sample/$time/x30_U_UMean.xy" u (\$5/Ub):1 title "X/h = 3" w lines lc "black" lw 2
set output "U_at_x_by_35.png"
plot \
"postProcessing/sample/$time/x35_U_UMean.xy" u (\$5/Ub):1 title "X/h = 3.5" w lines lc "black" lw 2
set output "U_at_x_by_40.png"
plot \
"postProcessing/sample/$time/x40_U_UMean.xy" u (\$5/Ub):1 title "X/h = 4" w lines lc "black" lw 2
EOF

View File

@ -0,0 +1,240 @@
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: plus |
| \\ / A nd | Web: www.OpenFOAM.com |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class dictionary;
object blockMeshDict;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
scale 1;
x_up 3.5;
x_down 10;
y_pad 4;
z_pad 1;
x0 0;
x1 $x_up;
x2 #calc "$x1 + 1";
x3 #calc "$x2 + $x_down";
y0 0;
y1 $y_pad;
y2 #calc "$y1 + 1";
y3 #calc "$y2 + $y_pad";
z0 0;
z1 1;
z2 #calc "$z1 + $z_pad";
nx1 40;
nx2 40;
nx3 80;
ny1 30;
ny2 $nx2;
ny3 $ny1;
nz1 $nx2;
nz2 40;
vertices
(
($x0 $y0 $z0) // 0
($x1 $y0 $z0) // 1
($x2 $y0 $z0) // 2
($x3 $y0 $z0) // 3
($x0 $y0 $z1) // 4
($x1 $y0 $z1) // 5
($x2 $y0 $z1) // 6
($x3 $y0 $z1) // 7
($x0 $y0 $z2) // 8
($x1 $y0 $z2) // 9
($x2 $y0 $z2) // 10
($x3 $y0 $z2) // 11
($x0 $y1 $z0) // 12
($x1 $y1 $z0) // 13
($x2 $y1 $z0) // 14
($x3 $y1 $z0) // 15
($x0 $y1 $z1) // 16
($x1 $y1 $z1) // 17
($x2 $y1 $z1) // 18
($x3 $y1 $z1) // 19
($x0 $y1 $z2) // 20
($x1 $y1 $z2) // 21
($x2 $y1 $z2) // 22
($x3 $y1 $z2) // 23
($x0 $y2 $z0) // 24
($x1 $y2 $z0) // 25
($x2 $y2 $z0) // 26
($x3 $y2 $z0) // 27
($x0 $y2 $z1) // 28
($x1 $y2 $z1) // 29
($x2 $y2 $z1) // 30
($x3 $y2 $z1) // 31
($x0 $y2 $z2) // 32
($x1 $y2 $z2) // 33
($x2 $y2 $z2) // 34
($x3 $y2 $z2) // 35
($x0 $y3 $z0) // 36
($x1 $y3 $z0) // 37
($x2 $y3 $z0) // 38
($x3 $y3 $z0) // 39
($x0 $y3 $z1) // 40
($x1 $y3 $z1) // 41
($x2 $y3 $z1) // 42
($x3 $y3 $z1) // 43
($x0 $y3 $z2) // 44
($x1 $y3 $z2) // 45
($x2 $y3 $z2) // 46
($x3 $y3 $z2) // 47
);
edges
(
);
//x_up ((0.4 0.3 0.5)(0.6 0.7 1));
//x_down ((0.4 0.75 1)(0.6 0.25 10));
//z_top ((0.3 0.4 1)(0.7 0.6 2));
//y_side1 ((0.6 0.4 0.25)(0.4 0.6 1));
//y_side2 ((0.4 0.6 1)(0.6 0.4 4));
x_up ((0.4 0.25 0.5)(0.3 0.25 0.75)(0.3 0.5 0.2));
x_down ((0.15 0.45 3)(0.25 0.35 1.5)(0.6 0.2 5));
z_top ((0.2 0.25 4)(0.6 0.5 1)(0.2 0.25 0.25));
z_bottom ((0.2 0.25 4)(0.6 0.5 1)(0.2 0.25 0.25));
y_side1 ((0.4 0.1 0.5)(0.4 0.2 0.5)(0.3 0.7 0.1));
y_side2 ((0.3 0.7 10)(0.4 0.2 2)(0.4 0.1 2));
blocks
(
hex ( 0 1 13 12 4 5 17 16) ($nx1 $ny1 $nz1) simpleGrading ( $x_up $y_side1 $z_bottom)
hex ( 1 2 14 13 5 6 18 17) ($nx2 $ny1 $nz1) simpleGrading ( 1 $y_side1 $z_bottom)
hex ( 2 3 15 14 6 7 19 18) ($nx3 $ny1 $nz1) simpleGrading ($x_down $y_side1 $z_bottom)
hex ( 4 5 17 16 8 9 21 20) ($nx1 $ny1 $nz2) simpleGrading ( $x_up $y_side1 $z_top)
hex ( 5 6 18 17 9 10 22 21) ($nx2 $ny1 $nz2) simpleGrading ( 1 $y_side1 $z_top)
hex ( 6 7 19 18 10 11 23 22) ($nx3 $ny1 $nz2) simpleGrading ($x_down $y_side1 $z_top)
hex (12 13 25 24 16 17 29 28) ($nx1 $ny2 $nz1) simpleGrading ($x_up 1 $z_bottom)
//hex (13 14 26 25 17 18 30 29) ($nx2 $ny2 $nz1) simpleGrading (1 1 $z_bottom)
hex (14 15 27 26 18 19 31 30) ($nx3 $ny2 $nz1) simpleGrading ($x_down 1 $z_bottom)
hex (16 17 29 28 20 21 33 32) ($nx1 $ny2 $nz2) simpleGrading ($x_up 1 $z_top)
hex (17 18 30 29 21 22 34 33) ($nx2 $ny2 $nz2) simpleGrading (1 1 $z_top)
hex (18 19 31 30 22 23 35 34) ($nx3 $ny2 $nz2) simpleGrading ($x_down 1 $z_top)
hex (24 25 37 36 28 29 41 40) ($nx1 $ny3 $nz1) simpleGrading ($x_up $y_side2 $z_bottom)
hex (25 26 38 37 29 30 42 41) ($nx2 $ny3 $nz1) simpleGrading (1 $y_side2 $z_bottom)
hex (26 27 39 38 30 31 43 42) ($nx3 $ny3 $nz1) simpleGrading ($x_down $y_side2 $z_bottom)
hex (28 29 41 40 32 33 45 44) ($nx1 $ny3 $nz2) simpleGrading ($x_up $y_side2 $z_top)
hex (29 30 42 41 33 34 46 45) ($nx2 $ny3 $nz2) simpleGrading (1 $y_side2 $z_top)
hex (30 31 43 42 34 35 47 46) ($nx3 $ny3 $nz2) simpleGrading ($x_down $y_side2 $z_top)
);
boundary
(
cube
{
type wall;
faces
(
(13 17 18 14)
(14 18 30 26)
(25 29 30 26)
(13 25 29 17)
(17 29 30 18)
);
}
topAndBottom
{
type wall;
faces
(
// floor
( 0 12 13 1)
( 1 13 14 2)
( 2 14 15 3)
(12 24 25 13)
(14 26 27 15)
(24 36 37 25)
(25 37 38 26)
(26 38 39 27)
// top
( 8 9 21 20)
( 9 10 22 21)
(10 11 23 22)
(20 21 33 32)
(21 22 34 33)
(22 23 35 34)
(32 33 45 44)
(33 34 46 45)
(34 35 47 46)
);
}
sides
{
type patch;
faces
(
// minY
( 0 1 5 4)
( 1 2 6 5)
( 2 3 7 6)
( 4 5 9 8)
( 5 6 10 9)
( 6 7 11 10)
// maxY
(36 40 41 37)
(37 41 42 38)
(38 42 43 39)
(40 44 45 41)
(41 45 46 42)
(42 46 47 43)
);
}
inlet
{
type patch;
faces
(
( 0 4 16 12)
(12 16 28 24)
(24 28 40 36)
( 4 8 20 16)
(16 20 32 28)
(28 32 44 40)
);
}
outlet
{
type patch;
faces
(
( 3 15 19 7)
(15 27 31 19)
(27 39 43 31)
( 7 19 23 11)
(19 31 35 23)
(31 43 47 35)
);
}
);
mergePatchPairs
(
);

View File

@ -0,0 +1,115 @@
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: plus |
| \\ / A nd | Web: www.OpenFOAM.com |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class dictionary;
object controlDict;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
libs ("libturbulenceModelSchemes.so");
application pimpleFoam;
startFrom startTime;
startTime 0;
stopAt endTime;
endTime 100;
deltaT 0.002;
writeControl timeStep;
writeInterval 100;
purgeWrite 3;
writeFormat binary;
writePrecision 6;
writeCompression off;
timeFormat general;
timePrecision 6;
runTimeModifiable true;
functions
{
minMax
{
type fieldMinMax;
libs ("libfieldFunctionObjects.so");
fields (U p);
}
DESField
{
type DESModelRegions;
libs ("libfieldFunctionObjects.so");
//region "region0";
writeControl writeTime;
}
Q1
{
type Q;
libs ("libfieldFunctionObjects.so");
writeControl writeTime;
}
vorticity1
{
type vorticity;
libs ("libfieldFunctionObjects.so");
writeControl writeTime;
}
yPlus
{
type yPlus;
libs ("libfieldFunctionObjects.so");
writeControl writeTime;
}
fieldAverage1
{
type fieldAverage;
libs ("libfieldFunctionObjects.so");
writeControl writeTime;
timeStart 10;
fields
(
U
{
mean on;
prime2Mean on;
base time;
}
p
{
mean on;
prime2Mean on;
base time;
}
);
}
sample1
{
#include "sample"
}
}
// ************************************************************************* //

View File

@ -0,0 +1,31 @@
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: plus |
| \\ / A nd | Web: www.OpenFOAM.com |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class dictionary;
note "mesh decomposition control dictionary";
object decomposeParDict;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
numberOfSubdomains 8;
method hierarchical;
hierarchicalCoeffs
{
n (8 1 1);
// delta 0.001; //< default value = 0.001
// order xyz; //< default order = xyz
}
// ************************************************************************* //

View File

@ -0,0 +1,70 @@
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: plus |
| \\ / A nd | Web: www.OpenFOAM.com |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class dictionary;
object fvSchemes;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
ddtSchemes
{
default backward;
}
gradSchemes
{
default leastSquares; // Gauss linear;
}
divSchemes
{
default none;
div(phi,U) Gauss DEShybrid
linear // scheme 1
linearUpwind grad(U) // scheme 2
hmax
0.65 // DES coefficient, typically = 0.65
1 // Reference velocity scale
1 // Reference length scale
0 // Minimum sigma limit (0-1)
1 // Maximum sigma limit (0-1)
1; // 1.0e-03; // Limiter of B function, typically 1e-03
// div(phi,U) Gauss LUST grad(U);// linear;
div(phi,k) Gauss limitedLinear 0.1;
div(phi,B) Gauss limitedLinear 0.1;
div(B) Gauss linear;
div(phi,nuTilda) Gauss limitedLinear 0.1;
div((nuEff*dev2(T(grad(U))))) Gauss linear;
}
laplacianSchemes
{
default Gauss linear orthogonal;
}
interpolationSchemes
{
default linear;
}
snGradSchemes
{
default orthogonal;
}
wallDist
{
method meshWave;
nRequired yes;
}
// ************************************************************************* //

View File

@ -0,0 +1,61 @@
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: plus |
| \\ / A nd | Web: www.OpenFOAM.com |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class dictionary;
location "system";
object fvSolution;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
solvers
{
p
{
solver GAMG;
tolerance 0;
relTol 0.01;
smoother DICGaussSeidel;
}
pFinal
{
$p;
tolerance 1e-6;
relTol 0;
}
"(U|k|nuTilda)"
{
solver PBiCGStab;
preconditioner DILU;
tolerance 1e-8;
relTol 0.1;
}
"(U|k|nuTilda)Final"
{
$U;
tolerance 1e-06;
relTol 0;
}
}
PIMPLE
{
nOuterCorrectors 3;
nCOrrectors 1;
nNonOrthogonalCorrectors 0;
}
// ************************************************************************* //

View File

@ -0,0 +1,125 @@
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: plus |
| \\ / A nd | Web: www.OpenFOAM.com |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class dictionary;
location "system";
object sample;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
type sets;
libs ("libsampling.so");
writeControl writeTime;
interpolationScheme cellPoint;
setFormat raw;
sets
(
xm10
{
type face;
axis z;
start (2.5 4.5 0);
end (2.5 4.5 2);
}
xm05
{
type face;
axis z;
start (3 4.5 0);
end (3 4.5 2);
}
x00
{
type face;
axis z;
start (3.5 4.5 1);
end (3.5 4.5 2);
}
x05
{
type face;
axis z;
start (4 4.5 1);
end (4 4.5 2);
}
x10
{
type face;
axis z;
start (4.5 4.5 1);
end (4.5 4.5 2);
}
x15
{
type face;
axis z;
start (5 4.5 0);
end (5 4.5 2);
}
x20
{
type face;
axis z;
start (5.5 4.5 0);
end (5.5 4.5 2);
}
x25
{
type face;
axis z;
start (6 4.5 0);
end (6 4.5 2);
}
x30
{
type face;
axis z;
start (6.5 4.5 0);
end (6.5 4.5 2);
}
x35
{
type face;
axis z;
start (7 4.5 0);
end (7 4.5 2);
}
x40
{
type face;
axis z;
start (7.5 4.5 0);
end (7.5 4.5 2);
}
x45
{
type face;
axis z;
start (8 4.5 0);
end (8 4.5 2);
}
x50
{
type face;
axis z;
start (8.5 4.5 0);
end (8.5 4.5 2);
}
);
fields (U UMean);
// ************************************************************************* //

View File

@ -0,0 +1,47 @@
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: plus |
| \\ / 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 (1 0 0);
boundaryField
{
lowerWall
{
type noSlip;
}
upperWall
{
type noSlip;
}
inlet
{
type cyclic;
}
outlet
{
type cyclic;
}
frontAndBack
{
type empty;
}
}
// ************************************************************************* //

View File

@ -0,0 +1,49 @@
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: plus |
| \\ / A nd | Web: www.OpenFOAM.com |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class volScalarField;
location "0";
object epsilon;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
dimensions [0 2 -3 0 0 0 0];
internalField uniform 180.18; // 10;
boundaryField
{
lowerWall
{
type fixedValue;
value uniform 1e-08;
}
upperWall
{
type fixedValue;
value uniform 1e-08;
}
inlet
{
type cyclic;
}
outlet
{
type cyclic;
}
frontAndBack
{
type empty;
}
}
// ************************************************************************* //

View File

@ -0,0 +1,49 @@
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: plus |
| \\ / A nd | Web: www.OpenFOAM.com |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class volScalarField;
location "0";
object k;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
dimensions [0 2 -2 0 0 0 0];
internalField uniform 18.06; // 0.1;
boundaryField
{
lowerWall
{
type fixedValue;
value uniform 1e-10;
}
upperWall
{
type fixedValue;
value uniform 1e-10;
}
inlet
{
type cyclic;
}
outlet
{
type cyclic;
}
frontAndBack
{
type empty;
}
}
// ************************************************************************* //

View File

@ -0,0 +1,49 @@
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: plus |
| \\ / A nd | Web: www.OpenFOAM.com |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class volScalarField;
location "0";
object nuTilda;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
dimensions [0 2 -1 0 0 0 0];
internalField uniform 0;
boundaryField
{
lowerWall
{
type fixedValue;
value uniform 0;
}
upperWall
{
type fixedValue;
value uniform 0;
}
inlet
{
type cyclic;
}
outlet
{
type cyclic;
}
frontAndBack
{
type empty;
}
}
// ************************************************************************* //

View File

@ -0,0 +1,55 @@
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: plus |
| \\ / A nd | Web: www.OpenFOAM.com |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class volScalarField;
location "0";
object nut;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
dimensions [0 2 -1 0 0 0 0];
internalField uniform 0;
boundaryField
{
lowerWall
{
type nutLowReWallFunction;
Cmu 0.09;
kappa 0.41;
E 9.8;
value uniform 0;
}
upperWall
{
type nutLowReWallFunction;
Cmu 0.09;
kappa 0.41;
E 9.8;
value uniform 0;
}
inlet
{
type cyclic;
}
outlet
{
type cyclic;
}
frontAndBack
{
type empty;
}
}
// ************************************************************************* //

View File

@ -0,0 +1,8 @@
#!/bin/sh
cd ${0%/*} || exit 1 # run from this directory
# Source tutorial clean functions
. $WM_PROJECT_DIR/bin/tools/CleanFunctions
cleanCase

View File

@ -0,0 +1,9 @@
#!/bin/sh
cd ${0%/*} || exit 1 # run from this directory
# Source tutorial run functions
. $WM_PROJECT_DIR/bin/tools/RunFunctions
runApplication blockMesh
runApplication $(getApplication)

View File

@ -0,0 +1,25 @@
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: plus |
| \\ / A nd | Web: www.OpenFOAM.com |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class dictionary;
location "constant";
object transportProperties;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
Ubar (1 0 0);
transportModel Newtonian;
nu 2.5e-05;
// ************************************************************************* //

View File

@ -0,0 +1,30 @@
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: plus |
| \\ / A nd | Web: www.OpenFOAM.com |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class dictionary;
location "constant";
object turbulenceProperties;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
simulationType RAS;
RAS
{
RASModel LaunderSharmaKE;
turbulence on;
printCoeffs on;
}
// ************************************************************************* //

View File

@ -0,0 +1,104 @@
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: plus |
| \\ / A nd | Web: www.OpenFOAM.com |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class dictionary;
object blockMeshDict;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
scale 1;
vertices
(
(0 0 0)
(1 0 0)
(1 1 0)
(0 1 0)
(0 0 1)
(1 0 1)
(1 1 1)
(0 1 1)
(0 0 2)
(1 0 2)
(1 1 2)
(0 1 2)
);
blocks
(
hex (0 1 2 3 4 5 6 7) (1 1 50) simpleGrading (1 1 100)
hex (4 5 6 7 8 9 10 11) (1 1 50) simpleGrading (1 1 0.01)
);
edges
(
);
boundary
(
lowerWall
{
type wall;
faces
(
(0 3 2 1)
);
}
upperWall
{
type wall;
faces
(
(8 9 10 11)
);
}
inlet
{
type cyclic;
neighbourPatch outlet;
faces
(
(0 4 7 3)
(4 8 11 7)
);
}
outlet
{
type cyclic;
neighbourPatch inlet;
faces
(
(1 2 6 5)
(5 6 10 9)
);
}
frontAndBack
{
type empty;
faces
(
(0 1 5 4)
(4 5 9 8)
(3 7 6 2)
(7 11 10 6)
);
}
);
mergePatchPairs
(
);
// ************************************************************************* //

View File

@ -0,0 +1,85 @@
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: plus |
| \\ / A nd | Web: www.OpenFOAM.com |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class dictionary;
location "system";
object controlDict;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
application boundaryFoam;
startFrom startTime;
startTime 0;
stopAt endTime;
endTime 2000;
deltaT 1;
writeControl timeStep;
writeInterval 200;
purgeWrite 1;
writeFormat ascii;
writePrecision 6;
writeCompression off;
timeFormat general;
timePrecision 6;
runTimeModifiable true;
graphFormat raw;
functions
{
turbulenceFields
{
type turbulenceFields;
libs ("libfieldFunctionObjects.so");
writeControl writeTime;
fields (R nuTilda k epsilon omega L);
}
surfaces
{
type surfaces;
surfaceFormat boundaryData;
writeControl writeTime;
interpolationScheme cell;
fields
(
U
turbulenceProperties:R
turbulenceProperties:nuTilda
turbulenceProperties:L
);
surfaces
(
inlet
{
type patch;
patches (inlet);
interpolate false;
}
);
}
}
// ************************************************************************* //

View File

@ -0,0 +1,59 @@
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: plus |
| \\ / A nd | Web: www.OpenFOAM.com |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class dictionary;
location "system";
object fvSchemes;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
ddtSchemes
{
default steadyState;
}
gradSchemes
{
default Gauss linear;
}
divSchemes
{
default none;
div(phi,k) bounded Gauss linear;
div(phi,epsilon) bounded Gauss linear;
div(phi,R) bounded Gauss linear;
div(phi,nuTilda) bounded Gauss linear;
div((nuEff*dev2(T(grad(U))))) Gauss linear;
}
laplacianSchemes
{
default none;
laplacian(nuEff,U) Gauss linear corrected;
laplacian(DkEff,k) Gauss linear corrected;
laplacian(DepsilonEff,epsilon) Gauss linear corrected;
laplacian(DREff,R) Gauss linear corrected;
laplacian(DnuTildaEff,nuTilda) Gauss linear corrected;
}
interpolationSchemes
{
default linear;
}
snGradSchemes
{
default corrected;
}
// ************************************************************************* //

View File

@ -0,0 +1,56 @@
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: plus |
| \\ / A nd | Web: www.OpenFOAM.com |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class dictionary;
location "system";
object fvSolution;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
solvers
{
U
{
solver PCG;
preconditioner DIC;
tolerance 1e-06;
relTol 0;
}
"(k|epsilon|R|nuTilda)"
{
solver smoothSolver;
smoother symGaussSeidel;
tolerance 1e-06;
relTol 0;
}
}
PISO
{
nCorrectors 2;
nNonOrthogonalCorrectors 0;
}
relaxationFactors
{
equations
{
U 0.5;
k 0.7;
epsilon 0.7;
R 0.7;
nuTilda 0.7;
}
}
// ************************************************************************* //

View File

@ -0,0 +1,50 @@
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: plus |
| \\ / A nd | Web: www.OpenFOAM.com |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class volVectorField;
object U;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
dimensions [0 1 -1 0 0 0 0];
internalField uniform (1e-8 0 0);
boundaryField
{
inlet
{
type fixedValue;
value uniform (44.2 0 0);
}
outlet
{
type zeroGradient;
}
"(lowerWallStartup|upperWallStartup)"
{
type symmetryPlane;
}
"(upperWall|lowerWall)"
{
type noSlip;
}
"(front|back)"
{
type empty;
}
}
// ************************************************************************* //

View File

@ -0,0 +1,53 @@
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: plus |
| \\ / A nd | Web: www.OpenFOAM.com |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class volScalarField;
location "0";
object epsilon;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
dimensions [0 2 -3 0 0 0 0];
internalField uniform 17.83;
boundaryField
{
inlet
{
type fixedValue;
value $internalField;
}
outlet
{
type zeroGradient;
}
"(lowerWallStartup|upperWallStartup)"
{
type symmetryPlane;
}
"(upperWall|lowerWall)"
{
type epsilonWallFunction;
value $internalField;
}
"(front|back)"
{
type empty;
}
}
// ************************************************************************* //

View File

@ -0,0 +1,53 @@
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: plus |
| \\ / A nd | Web: www.OpenFOAM.com |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class volScalarField;
location "0";
object k;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
dimensions [0 2 -2 0 0 0 0];
internalField uniform 1.09e-3; // 0.061%
boundaryField
{
inlet
{
type fixedValue;
value $internalField;
}
outlet
{
type zeroGradient;
}
"(lowerWallStartup|upperWallStartup)"
{
type symmetryPlane;
}
"(upperWall|lowerWall)"
{
type kqRWallFunction;
value $internalField;
}
"(front|back)"
{
type empty;
}
}
// ************************************************************************* //

View File

@ -0,0 +1,50 @@
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: plus |
| \\ / A nd | Web: www.OpenFOAM.com |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class volScalarField;
object nuTilda;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
dimensions [0 2 -1 0 0 0 0];
internalField uniform 0;
boundaryField
{
inlet
{
type fixedValue;
value $internalField;
}
outlet
{
type zeroGradient;
}
"(lowerWallStartup|upperWallStartup)"
{
type symmetryPlane;
}
"(upperWall|lowerWall)"
{
type zeroGradient;
}
"(front|back)"
{
type empty;
}
}
// ************************************************************************* //

View File

@ -0,0 +1,54 @@
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: plus |
| \\ / A nd | Web: www.OpenFOAM.com |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class volScalarField;
location "0";
object nut;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
dimensions [0 2 -1 0 0 0 0];
internalField uniform 0;
boundaryField
{
inlet
{
type calculated;
value uniform 0;
}
outlet
{
type calculated;
value uniform 0;
}
"(lowerWallStartup|upperWallStartup)"
{
type symmetryPlane;
}
"(upperWall|lowerWall)"
{
type nutUBlendedWallFunction;
value uniform 0;
}
"(front|back)"
{
type empty;
}
}
// ************************************************************************* //

View File

@ -0,0 +1,53 @@
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: plus |
| \\ / A nd | Web: www.OpenFOAM.com |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class volScalarField;
location "0";
object omega;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
dimensions [0 0 -1 0 0 0 0];
internalField uniform 181728;
boundaryField
{
inlet
{
type fixedValue;
value $internalField;
}
outlet
{
type zeroGradient;
}
"(lowerWallStartup|upperWallStartup)"
{
type symmetryPlane;
}
"(upperWall|lowerWall)"
{
type omegaWallFunction;
value $internalField;
}
"(front|back)"
{
type empty;
}
}
// ************************************************************************* //

View File

@ -0,0 +1,50 @@
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: plus |
| \\ / A nd | Web: www.OpenFOAM.com |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class volScalarField;
object p;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
dimensions [0 2 -2 0 0 0 0];
internalField uniform 0;
boundaryField
{
inlet
{
type zeroGradient;
}
outlet
{
type fixedValue;
value uniform 0;
}
"(lowerWallStartup|upperWallStartup)"
{
type symmetryPlane;
}
"(upperWall|lowerWall)"
{
type zeroGradient;
}
"(front|back)"
{
type empty;
}
}
// ************************************************************************* //

View File

@ -0,0 +1,10 @@
#!/bin/sh
cd ${0%/*} || exit 1 # run from this directory
# Source tutorial clean functions
. $WM_PROJECT_DIR/bin/tools/CleanFunctions
cleanCase
\rm -rf *.dat *.png

View File

@ -0,0 +1,100 @@
#!/bin/sh
cd ${0%/*} || exit 1 # run from this directory
# Source tutorial run functions
. $WM_PROJECT_DIR/bin/tools/RunFunctions
runApplication blockMesh
runApplication simpleFoam
if notTest $@
then
# Create validation plots
# Test if gnuplot exists on the system
command -v gnuplot >/dev/null 2>&1 || {
echo "gnuplot not found - skipping graph creation" 1>&2
exit 1
}
# Copy results to the validation directory
timeDir=$(foamListTimes -latestTime)
sampleDir=postProcessing/sample/$timeDir
[ -d $sampleDir ] || {
echo "results directory not found - skipping graph creation" 1>&2
exit 1
}
# Test if awk exists on the system
command -v awk >/dev/null 2>&1 || {
echo "awk not found - skipping graph creation" 1>&2
exit 1
}
Uref=$(awk '{print $2}' $sampleDir/Uref_U.xy)
graphNameU="backwardStep2D_U.png"
echo "Creating U profiles graph to $graphNameU"
gnuplot<<EOF1
set terminal pngcairo font "helvetica,20" size 1000, 1000
set xrange [-0.4:1.2]
set yrange [0:3]
set xlabel "U/U_0"
set ylabel "y/h"
set grid
set output "$graphNameU"
href = 0.0127
Uref = $Uref
set lmargin 7.5
set rmargin 1.5
set tmargin 0.1
set bmargin 3.2
set key top left
set format x "%.1f"
set format y "%.1f"
plot \
"$sampleDir/x_by_h_01_U.xy" u (\$2/Uref):(\$1/href) w lines lw 2 lc rgb "red" t "x/h = 1", \
"$sampleDir/x_by_h_04_U.xy" u (\$2/Uref):(\$1/href) w lines lw 2 lc rgb "green" t "x/h = 4", \
"$sampleDir/x_by_h_06_U.xy" u (\$2/Uref):(\$1/href) w lines lw 2 lc rgb "blue" t "x/h = 6", \
"$sampleDir/x_by_h_10_U.xy" u (\$2/Uref):(\$1/href) w lines lw 2 lc rgb "black" t "x/h = 10"
EOF1
echo "# ccx tau_xx tau_yy tau_zz" > tauw.dat
foamDictionary -entry boundaryField.lowerWall.value -value $timeDir/Cx | \
sed -n '/(/,/)/p' | sed -e 's/[()]//g;/^\s*$/d' > Cx.$$
foamDictionary -entry boundaryField.lowerWall.value -value $timeDir/wallShearStress | \
sed -n '/(/,/)/p' | sed -e 's/[()]//g;/^\s*$/d' > tau.$$
paste -d ' ' Cx.$$ tau.$$ >> tauw.dat
\rm -f Cx.$$ tau.$$
graphNameTau="backwardStep2D_tau.png"
echo "Creating wallshear stress graph to $graphNameTau"
gnuplot<<EOF2
set terminal pngcairo font "helvetica,20" size 1000, 1000
set xrange [-5:30]
set yrange [-0.002:0.004]
set grid
set key bottom right
set xlabel "x/h"
set ylabel "c_f"
set output "$graphNameTau"
Uref = $Uref
href = 0.0127
set lmargin 10
set rmargin 1.5
set tmargin 0.1
set bmargin 3.2
plot "tauw.dat" u (\$1/href):(-\$2/(0.5*Uref*Uref)) t "simpleFoam" w l lw 2 lc rgb "black"
EOF2
fi

View File

@ -0,0 +1,22 @@
Steady flow over a 2D backward facing step
This canonical case is based on the description by Driver and Seegmiller
D.M. Driver and H.L. Seegmiller. Features of a reattaching turbulent shear
layer in divergent channel flow. AIAA Journal, 23(2):163171, 1985.
where the mesh is based on the Langley Research Center Turbulence Modeling
Resource set-up provided at:
https://turbmodels.larc.nasa.gov/backstep_val.html
The Reynolds number based on the step height is Reh 36000 for which the
stated reattachment length is at 6.26 +/- 0.1 x/h
The Allrun script will run the case and generate graphs showing the wall
shear stress and velocity profiles at various cross-sections.
For further information please visit:
openfoam.com/documentation/cpp-guide/html/verification-validation-turbulent-backward-facing-step.html

View File

@ -0,0 +1,22 @@
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: plus |
| \\ / A nd | Web: www.OpenFOAM.com |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class dictionary;
location "constant";
object transportProperties;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
transportModel Newtonian;
nu 1.56e-05;
// ************************************************************************* //

View File

@ -0,0 +1,30 @@
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: plus |
| \\ / A nd | Web: www.OpenFOAM.com |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class dictionary;
location "constant";
object turbulenceProperties;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
simulationType RAS;
RAS
{
RASModel kOmegaSST; // kEpsilon;
turbulence on;
printCoeffs on;
}
// ************************************************************************* //

View File

@ -0,0 +1,202 @@
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: plus |
| \\ / A nd | Web: www.OpenFOAM.com |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class dictionary;
object blockMeshDict;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
scale 0.0127;
vertices
(
( -130 1 1) // 0
( -110 1 1) // 1
( 0 1 1) // 2
( 0 0 1) // 3
( 8 0 1) // 4
( 50 0 1) // 5
( 8 1 1) // 6
( 50 3.125 1) // 7
( 50 9 1) // 8
( 8 9 1) // 9
( 0 9 1) // 10
( -110 9 1) // 11
( -130 9 1) // 12
( -130 1 0) // 13
( -110 1 0) // 14
( 0 1 0) // 15
( 0 0 0) // 16
( 8 0 0) // 17
( 50 0 0) // 18
( 8 1 0) // 19
( 50 3.125 0) // 20
( 50 9 0) // 21
( 8 9 0) // 22
( 0 9 0) // 23
( -110 9 0) // 24
( -130 9 0) // 25
);
ySpacing ((0.3 0.47 250)(0.2 0.06 1)(0.3 0.47 0.004));
ySpacing2 ((0.75 0.3 1)(0.25 0.7 0.004));
yWall ((0.5 0.5 100)(0.5 0.5 0.03));
yLower1 ((0.4 0.7 50)(0.6 0.3 1));
yLower2 ((1 1 50));
//yUpper1 ((0.1 0.15 2)(0.75 0.35 4)(0.25 0.5 0.005));
yUpper1 ((0.1 0.2 2)(0.75 0.35 5)(0.25 0.45 0.005));
blocks
(
// Coarse
// Block 0
hex (13 14 24 25 0 1 11 12)
(2 65 1)
simpleGrading (0.3 $ySpacing 1)
// Block 1
hex (14 15 23 24 1 2 10 11)
(88 65 1)
simpleGrading (((106 63 0.1)(4 25 0.3)) $ySpacing 1)
// Block 2
hex (16 17 19 15 3 4 6 2)
(97 48 1)
// simpleGrading (1 1 1)
edgeGrading (1 1 1 1 $yWall $yLower1 $yLower1 $yWall 1 1 1 1)
// Block 3
hex (17 18 20 19 4 5 7 6)
(33 48 1)
// simpleGrading (100 1 1)
edgeGrading (80 80 80 80 $yLower1 $yLower2 $yLower2 $yLower1 1 1 1 1)
// Block 4
hex (15 19 22 23 2 6 9 10)
(97 65 1)
// simpleGrading (1 $ySpacing 1)
edgeGrading (1 1 1 1 $ySpacing $yUpper1 $yUpper1 $ySpacing 1 1 1 1)
// Block 5
hex (19 20 21 22 6 7 8 9)
(33 65 1)
// simpleGrading (100 $ySpacing 1)
edgeGrading (80 80 80 80 $yUpper1 $ySpacing2 $ySpacing2 $yUpper1 1 1 1 1)
/*
// fine
hex (0 1 9 8 7 6 14 15)
(800 1 100)
simpleGrading (1 1 200)
hex (2 3 11 10 1 4 12 9)
(400 1 150)
simpleGrading (((1 10 5)(1 1 10)) 1 ((1 1 10 )(1 1 0.1)))
hex (1 4 12 9 6 5 13 14)
(400 1 100)
simpleGrading (((1 10 5)(1 1 10)) 1 200)
*/
);
edges
(
);
boundary
(
inlet
{
type patch;
faces
(
(13 0 12 25)
);
}
outlet
{
type patch;
faces
(
(18 20 7 5)
(20 21 8 7)
);
}
lowerWallStartup
{
type symmetryPlane;
faces
(
(13 14 1 0)
);
}
upperWallStartup
{
type symmetryPlane;
faces
(
(25 12 11 24)
);
}
upperWall
{
type wall;
faces
(
(24 11 10 23)
(23 10 9 22)
(22 9 8 21)
);
}
lowerWall
{
type wall;
faces
(
(14 15 2 1)
(15 2 3 16)
(16 17 4 3)
(17 18 5 4)
);
}
front
{
type empty;
faces
(
(0 1 11 12)
(1 2 10 11)
(3 4 6 2)
(4 5 7 6)
(2 6 9 10)
(6 7 8 9)
);
}
back
{
type empty;
faces
(
(13 25 24 14)
(14 24 23 15)
(16 15 19 17)
(17 19 20 18)
(15 23 22 19)
(19 22 21 20)
);
}
);
// ************************************************************************* //

View File

@ -0,0 +1,58 @@
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: plus |
| \\ / A nd | Web: www.OpenFOAM.com |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class dictionary;
location "system";
object controlDict;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
application simpleFoam;
startFrom startTime;
startTime 0;
stopAt endTime;
endTime 2000;
deltaT 1;
writeControl timeStep;
writeInterval 100;
purgeWrite 5;
writeFormat ascii;
writePrecision 6;
writeCompression off;
timeFormat general;
timePrecision 6;
runTimeModifiable true;
functions
{
#includeFunc "stressComponents"
#includeFunc "pressureCoefficient"
#includeFunc "sample"
#includeFunc "sampleCp"
#includeFunc "writeCellCentres"
#includeFunc "wallShearStress"
}
// ************************************************************************* //

View File

@ -0,0 +1,59 @@
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: plus |
| \\ / A nd | Web: www.OpenFOAM.com |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class dictionary;
location "system";
object fvSchemes;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
ddtSchemes
{
default steadyState;
}
gradSchemes
{
default Gauss linear;
}
divSchemes
{
default none;
div(phi,U) bounded Gauss LUST grad(U);
div(phi,k) bounded Gauss limitedLinear 1;
div(phi,epsilon) bounded Gauss limitedLinear 1;
div(phi,omega) bounded Gauss limitedLinear 1;
div((nuEff*dev2(T(grad(U))))) Gauss linear;
}
laplacianSchemes
{
default Gauss linear corrected;
}
interpolationSchemes
{
default linear;
}
snGradSchemes
{
default corrected;
}
wallDist
{
method meshWave;
}
// ************************************************************************* //

View File

@ -0,0 +1,60 @@
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: plus |
| \\ / A nd | Web: www.OpenFOAM.com |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class dictionary;
location "system";
object fvSolution;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
solvers
{
p
{
solver GAMG;
tolerance 1e-10;
relTol 0.1;
smoother DICGaussSeidel;
}
"(U|k|epsilon|omega)"
{
solver smoothSolver;
smoother symGaussSeidel;
tolerance 1e-10;
relTol 0.1;
}
}
SIMPLE
{
nNonOrthogonalCorrectors 0;
consistent yes;
residualControl
{
p 1e-4;
U 1e-6;
"(k|epsilon|omega|f|v2)" 1e-5;
}
}
relaxationFactors
{
equations
{
U 0.9;
".*" 0.8;
}
}
// ************************************************************************* //

View File

@ -0,0 +1,14 @@
type pressure;
libs ("libfieldFunctionObjects.so");
writeControl writeTime;
calcCoeff yes;
calcTotal no;
result cp;
rho rhoInf;
rhoInf 1;
pInf 0;
UInf (44.2 0 0);

View File

@ -0,0 +1,61 @@
type sets;
libs ("libsampling.so");
writeControl writeTime;
interpolationScheme cellPoint;
setFormat raw;
sets
(
Uref
{
type cloud;
axis y;
points ((-0.0508 0.0508 0.01));
}
x_by_h_m04
{
type face;
axis y;
start (-0.0508 -0.0127 0);
end (-0.0508 0.1016 0);
nPoints 100;
}
x_by_h_01
{
type face;
axis y;
start (0.0127 -0.0127 0);
end (0.0127 0.1016 0);
nPoints 100;
}
x_by_h_04
{
type face;
axis y;
start (0.0508 -0.0127 0);
end (0.0508 0.1016 0);
nPoints 100;
}
x_by_h_06
{
type face;
axis y;
start (0.0762 -0.0127 0);
end (0.0762 0.1016 0);
nPoints 100;
}
x_by_h_10
{
type face;
axis y;
start (0.127 -0.0127 0);
end (0.127 0.1016 0);
nPoints 100;
}
);
fields (p U turbulenceProperties:devReff);

View File

@ -0,0 +1,7 @@
type patchProbes;
libs ("libsampling.so");
writeControl writeTime;
patch lowerWall;
probeLocations ();
fields (cp);

View File

@ -0,0 +1,6 @@
type turbulenceFields;
libs ("libfieldFunctionObjects.so");
writeControl writeTime;
fields (devReff);

View File

@ -0,0 +1,56 @@
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: plus |
| \\ / A nd | Web: www.OpenFOAM.com |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class volVectorField;
object U;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
dimensions [0 1 -1 0 0 0 0];
internalField uniform (69.4 0 0);
boundaryField
{
inlet
{
type fixedValue;
value $internalField;
}
outlet
{
type zeroGradient;
}
topWall
{
type slip;
}
bottomWall
{
type fixedValue;
value uniform (0 0 0);
}
symmetry
{
type symmetryPlane;
}
frontAndBack
{
type empty;
}
}
// ************************************************************************* //

View File

@ -0,0 +1,57 @@
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: plus |
| \\ / A nd | Web: www.OpenFOAM.com |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class volScalarField;
object epsilon;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
dimensions [0 2 -3 0 0 0 0];
internalField uniform 0.84321; // from kOmega model epsilon=omega*k*Cmu
boundaryField
{
inlet
{
type fixedValue;
value $internalField;
}
outlet
{
type zeroGradient;
}
topWall
{
type zeroGradient;
}
bottomWall
{
type epsilonWallFunction;
lowReCorrection on;
value $internalField;
}
symmetry
{
type symmetryPlane;
}
frontAndBack
{
type empty;
}
}
// ************************************************************************* //

View File

@ -0,0 +1,59 @@
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: plus |
| \\ / A nd | Web: www.OpenFOAM.com |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class volScalarField;
object k;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
dimensions [0 2 -2 0 0 0 0];
internalField uniform 1.08e-3; // 1.08e-3 = 1.125*(69.4)^2/5e6 // 11=3.9% 18.1=5%;
boundaryField
{
inlet
{
type fixedValue;
// type turbulentIntensityKineticEnergyInlet;
// intensity 0.05; // 5% turbulence
value $internalField;
}
outlet
{
type zeroGradient;
}
topWall
{
type zeroGradient;
}
bottomWall
{
type kqRWallFunction;
value $internalField;
}
symmetry
{
type symmetryPlane;
}
frontAndBack
{
type empty;
}
}
// ************************************************************************* //

View File

@ -0,0 +1,60 @@
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: plus |
| \\ / A nd | Web: www.OpenFOAM.com |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class volScalarField;
location "0";
object nut;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
dimensions [0 2 -1 0 0 0 0];
internalField uniform 1.25e-7;
boundaryField
{
inlet
{
type calculated;
value $internalField;
}
outlet
{
type calculated;
value $internalField;
}
topWall
{
type calculated;
value $internalField;
}
bottomWall
{
type nutkWallFunction;
value $internalField;
}
symmetry
{
type symmetryPlane;
}
frontAndBack
{
type empty;
}
}
// ************************************************************************* //

View File

@ -0,0 +1,66 @@
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: plus |
| \\ / A nd | Web: www.OpenFOAM.com |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class volScalarField;
object p;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
dimensions [0 2 -2 0 0 0 0];
internalField uniform 0;
boundaryField
{
inlet
{
type zeroGradient;
/*
type totalPressure;
rho none;
psi none;
p0 uniform 1.02828;
value uniform 1.02828;
*/
}
outlet
{
type fixedValue;
value uniform 0;
/*
type fixedValue;
value uniform 1;
*/
}
topWall
{
type zeroGradient;
}
bottomWall
{
type zeroGradient;
}
symmetry
{
type symmetryPlane;
}
frontAndBack
{
type empty;
}
}
// ************************************************************************* //

View File

@ -0,0 +1,56 @@
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: plus |
| \\ / A nd | Web: www.OpenFOAM.com |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class volVectorField;
object U;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
dimensions [0 1 -1 0 0 0 0];
internalField uniform (69.4 0 0);
boundaryField
{
inlet
{
type fixedValue;
value $internalField;
}
outlet
{
type zeroGradient;
}
topWall
{
type slip;
}
bottomWall
{
type fixedValue;
value uniform (0 0 0);
}
symmetry
{
type symmetryPlane;
}
frontAndBack
{
type empty;
}
}
// ************************************************************************* //

View File

@ -0,0 +1,59 @@
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: plus |
| \\ / A nd | Web: www.OpenFOAM.com |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class volScalarField;
object k;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
dimensions [0 2 -2 0 0 0 0];
internalField uniform 1.08e-3; // 1.08e-3 = 1.125*(69.4)^2/5e6 // 11=3.9% 18.1=5%;
boundaryField
{
inlet
{
type fixedValue;
// type turbulentIntensityKineticEnergyInlet;
// intensity 0.05; // 5% turbulence
value $internalField;
}
outlet
{
type zeroGradient;
}
topWall
{
type zeroGradient;
}
bottomWall
{
type kqRWallFunction;
value $internalField;
}
symmetry
{
type symmetryPlane;
}
frontAndBack
{
type empty;
}
}
// ************************************************************************* //

View File

@ -0,0 +1,60 @@
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: plus |
| \\ / A nd | Web: www.OpenFOAM.com |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class volScalarField;
location "0";
object nut;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
dimensions [0 2 -1 0 0 0 0];
internalField uniform 1.25e-7;
boundaryField
{
inlet
{
type calculated;
value $internalField;
}
outlet
{
type calculated;
value $internalField;
}
topWall
{
type calculated;
value $internalField;
}
bottomWall
{
type nutUSpaldingWallFunction;
value $internalField;
}
symmetry
{
type symmetryPlane;
}
frontAndBack
{
type empty;
}
}
// ************************************************************************* //

View File

@ -0,0 +1,60 @@
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: plus |
| \\ / A nd | Web: www.OpenFOAM.com |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class volScalarField;
object omega;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
dimensions [0 0 -1 0 0 0 0];
internalField uniform 8675; // 8675=125*69.4/1 ; // 0.011;
boundaryField
{
inlet
{
type fixedValue;
// type turbulentMixingLengthFrequencyInlet;
// mixingLength 1;
value $internalField;
}
outlet
{
type zeroGradient;
}
topWall
{
type zeroGradient;
}
bottomWall
{
type omegaWallFunction;
blended true;
value $internalField;
}
symmetry
{
type symmetryPlane;
}
frontAndBack
{
type empty;
}
}
// ************************************************************************* //

View File

@ -0,0 +1,66 @@
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: plus |
| \\ / A nd | Web: www.OpenFOAM.com |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class volScalarField;
object p;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
dimensions [0 2 -2 0 0 0 0];
internalField uniform 0;
boundaryField
{
inlet
{
type zeroGradient;
/*
type totalPressure;
rho none;
psi none;
p0 uniform 1.02828;
value uniform 1.02828;
*/
}
outlet
{
type fixedValue;
value uniform 0;
/*
type fixedValue;
value uniform 1;
*/
}
topWall
{
type zeroGradient;
}
bottomWall
{
type zeroGradient;
}
symmetry
{
type symmetryPlane;
}
frontAndBack
{
type empty;
}
}
// ************************************************************************* //

View File

@ -0,0 +1,11 @@
#!/bin/bash
#set -x
cd ${0%/*} || exit 1
. $WM_PROJECT_DIR/bin/tools/CleanFunctions
cleanCase
\rm -rf 0 postProcessing-*
\rm -f *.dat *.png constant/turbulenceProperties

View File

@ -0,0 +1,85 @@
#!/bin/sh
cd ${0%/*} || exit 1
# Source tutorial run functions
. $WM_PROJECT_DIR/bin/tools/RunFunctions
if notTest $@
then
models="
kOmegaSST
kEpsilon
"
declare -A grading_vs_yp
#level 5 gradings
grading_vs_yp[0.05]=50000
grading_vs_yp[1]=2200
grading_vs_yp[2]=950
grading_vs_yp[5]=300
grading_vs_yp[10]=130
grading_vs_yp[30]=30
grading_vs_yp[50]=15
grading_vs_yp[100]=5
# level 3 gradings
#grading_vs_yp[1]=9300
#grading_vs_yp[2]=4300
#grading_vs_yp[5]=1500
#grading_vs_yp[10]=650
#grading_vs_yp[30]=175
#grading_vs_yp[50]=90
#grading_vs_yp[100]=35
\cp constant/turbulenceProperties.orig constant/turbulenceProperties
for model in $models
do
echo "Processing model: $model"
runApplication -s $model foamDictionary -entry RAS.RASModel -set $model constant/turbulenceProperties
for i in "${!grading_vs_yp[@]}"
do
yp=$i
grading=${grading_vs_yp[$yp]}
echo "Mesh: y+ $yp"
\rm -rf 0 [1-9]*
\cp -rf 0.${model} 0
sed "s/GRADING/$grading/g" system/blockMeshDict.template > system/blockMeshDict
runApplication -s ${model}_${yp} blockMesh
runApplication -s ${model}_${yp} simpleFoam
UInf=$(foamDictionary -entry internalField 0/U | sed 's/^.*(\s*\([^ ]*\).*/\1/g')
nuInf=$(foamDictionary -entry nu constant/transportProperties | sed 's/^.*\s\(.*\);/\1/g')
timeDir=$(foamListTimes -latestTime)
echo "UInf = $UInf"
foamDictionary -entry boundaryField.bottomWall.value -value $timeDir/Cx | \
sed -n '/(/,/)/p' | sed -e 's/[()]//g;/^\s*$/d' > Cx.$$
foamDictionary -entry boundaryField.bottomWall.value -value $timeDir/wallShearStress | \
sed -n '/(/,/)/p' | sed -e 's/[()]//g;/^\s*$/d' > tau.$$
foamDictionary -entry boundaryField.bottomWall.value -value $timeDir/yPlus | \
sed -n '/(/,/)/p' | sed -e 's/[()]//g;/^\s*$/d' > yp.$$
echo "# ccx tau_xx tau_yy tau_zz" > tauw_${model}_${yp}.dat
paste -d ' ' Cx.$$ tau.$$ >> tauw_${model}_${yp}.dat
echo "# ccx y+" > yplus_${model}_${yp}.dat
paste -d ' ' Cx.$$ yp.$$ >> yplus_${model}_${yp}.dat
\rm -f Cx.$$ tau.$$ yp.$$
./plot $UInf $nuInf $model $yp
# Optionally store the results
#mv $timeDir ${model}_${yp}.${timeDir}
done
mv postProcessing postProcessing-${model}
done
fi

View File

@ -0,0 +1,17 @@
Steady flow over a 2D flat plate
This case is based on the zero pressure gradient flat plate test described
by the Langley Research Center Turbulence Modeling Resource provided at:
https://turbmodels.larc.nasa.gov/flatplate.html
The Reynolds number based on the plate length is of Re_L = 5×10^6
The Allrun script applies a selection of tubulence models to a range of y+
meshes which for which graphs are created that compare the predictions
against the data from Weighardt.
For further information please visit:
openfoam.com/documentation/cpp-guide/html/verification-validation-turbulent-flat-plate-zpg.html

View File

@ -0,0 +1,22 @@
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: plus |
| \\ / A nd | Web: www.OpenFOAM.com |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class dictionary;
location "constant";
object transportProperties;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
transportModel Newtonian;
nu 1.388e-05;
// ************************************************************************* //

View File

@ -0,0 +1,30 @@
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: plus |
| \\ / A nd | Web: www.OpenFOAM.com |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class dictionary;
location "constant";
object turbulenceProperties;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
simulationType RAS;
RAS
{
RASModel kEpsilon;
turbulence on;
printCoeffs on;
}
// ************************************************************************* //

View File

@ -0,0 +1,30 @@
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: plus |
| \\ / A nd | Web: www.OpenFOAM.com |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class dictionary;
location "constant";
object turbulenceProperties;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
simulationType RAS;
RAS
{
RASModel kOmegaSST;
turbulence on;
printCoeffs on;
}
// ************************************************************************* //

View File

@ -0,0 +1,28 @@
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: plus |
| \\ / A nd | Web: www.OpenFOAM.com |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2;
format ascii;
class dictionary;
location "constant";
object turbulenceProperties;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
simulationType RAS;
RAS
{
RASModel xxx;
turbulence on;
printCoeffs on;
}
// ************************************************************************* //

View File

@ -0,0 +1,26 @@
#!/bin/sh
cd ${0%/*} || exit 1 # run from this directory
Uinf=$1
nuInf=$2
model=$3
yp=$4
gnuplot<<EOF
set terminal pngcairo font "arial,16" size 800,600
set output "OF_${model}_YP${yp}.png"
set xlabel "Re_x"
set ylabel "Cf"
set grid
set key right top
set xrange [0:1e7]
set yrange [0:0.006]
UInf = $Uinf
nuInf = $nuInf
X0 = 0 # Location of start of plate
laminar(x) = 0.664/(sqrt(x)) # Blasius - laminar
weighardt(x) = 0.288*(log10(x))**(-2.45) # turbulent
plot \
weighardt(x) t "Weighardt" w lines lc "red" lw 2, \
"tauw_${model}_${yp}.dat" u (\$1 - X0)*UInf/nuInf:(sqrt(\$2*\$2 + \$3*\$3 + \$4*\$4)/(0.5*UInf*UInf)) title "$model y^+ ${yp}" w lines lc "black" lw 2
EOF

View File

@ -0,0 +1,133 @@
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: plus |
| \\ / A nd | Web: www.OpenFOAM.com |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class dictionary;
object blockMeshDict;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
scale 0.333333333333333;
vertices
(
(-1 0 0.3)
(0 0 0.3)
(6 0 0.3)
(6 3 0.3)
(0 3 0.3)
(-1 3 0.3)
(-1 0 0)
(0 0 0)
(6 0 0)
(6 3 0)
(0 3 0)
(-1 3 0)
);
blocks
(
// //5 patch bottomWall y+ : min = 0.045097146, max = 0.13949865, average = 0.052922426
hex (6 7 10 11 0 1 4 5) ( 96 385 1) simpleGrading (((1 9 0.15)(0.1 3 0.9)) 950 1)
hex (7 8 9 10 1 2 3 4) (449 385 1) simpleGrading (((0.1 22 1.5)(0.35 23 7)(0.515 12 1)) 950 1)
// 3
// hex (6 7 10 11 0 1 4 5) ( 24 97 1) simpleGrading (((1 9 0.15)(0.1 3 0.9)) 950 1)
// hex (7 8 9 10 1 2 3 4) (113 97 1) simpleGrading (((0.1 22 1.5)(0.35 23 7)(0.515 12 1)) 950 1)
//-------------------------------------------------------------------
//
// // 1 min = 0.60914299, max = 1.0197701, average = 0.71020364
// hex (6 7 10 11 0 1 4 5) (6 25 1) simpleGrading (((1 9 0.15)(0.1 3 0.9)) 50000 1)
// hex (7 8 9 10 1 2 3 4) (29 25 1) simpleGrading (((0.1 22 1.5)(0.35 23 7)(0.515 12 1)) 50000 1)
//
// // 2
// hex (6 7 10 11 0 1 4 5) (12 49 1) simpleGrading (((1 9 0.15)(0.1 3 0.9)) 50000 1)
// hex (7 8 9 10 1 2 3 4) (57 49 1) simpleGrading (((0.1 22 1.5)(0.35 23 7)(0.515 12 1)) 50000 1)
//
// // 3 patch bottomWall y+ : min = 0.18489745, max = 0.38018561, average = 0.21587743
// hex (6 7 10 11 0 1 4 5) ( 24 97 1) simpleGrading (((1 9 0.15)(0.1 3 0.9)) 50000 1)
// hex (7 8 9 10 1 2 3 4) (113 97 1) simpleGrading (((0.1 22 1.5)(0.35 23 7)(0.515 12 1)) 50000 1)
//
// // 4
// hex (6 7 10 11 0 1 4 5) ( 48 193 1) simpleGrading (((1 9 0.15)(0.1 3 0.9)) 50000 1)
// hex (7 8 9 10 1 2 3 4) (225 193 1) simpleGrading (((0.1 22 1.5)(0.35 23 7)(0.515 12 1)) 50000 1)
// //5 patch bottomWall y+ : min = 0.045097146, max = 0.13949865, average = 0.052922426
// hex (6 7 10 11 0 1 4 5) ( 96 385 1) simpleGrading (((1 9 0.15)(0.1 3 0.9)) 50000 1)
// hex (7 8 9 10 1 2 3 4) (449 385 1) simpleGrading (((0.1 22 1.5)(0.35 23 7)(0.515 12 1)) 50000 1)
);
edges
(
);
boundary
(
inlet
{
type patch;
faces
(
(6 0 5 11)
);
}
outlet
{
type patch;
faces
(
(8 9 3 2)
);
}
topWall
{
type wall;
faces
(
(11 5 4 10)
(10 4 3 9)
);
}
bottomWall
{
type wall;
faces
(
(7 8 2 1)
);
}
symmetry
{
type symmetryPlane;
faces
(
(6 7 1 0)
);
}
frontAndBack
{
type empty;
faces
(
(0 1 4 5)
(1 2 3 4)
(6 11 10 7)
(7 10 9 8)
);
}
);
mergePatchPairs
(
);
// ************************************************************************* //

View File

@ -0,0 +1,133 @@
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: plus |
| \\ / A nd | Web: www.OpenFOAM.com |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class dictionary;
object blockMeshDict;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
scale 0.333333333333333;
vertices
(
(-1 0 0.3)
(0 0 0.3)
(6 0 0.3)
(6 3 0.3)
(0 3 0.3)
(-1 3 0.3)
(-1 0 0)
(0 0 0)
(6 0 0)
(6 3 0)
(0 3 0)
(-1 3 0)
);
blocks
(
// //5 patch bottomWall y+ : min = 0.045097146, max = 0.13949865, average = 0.052922426
hex (6 7 10 11 0 1 4 5) ( 96 385 1) simpleGrading (((1 9 0.15)(0.1 3 0.9)) GRADING 1)
hex (7 8 9 10 1 2 3 4) (449 385 1) simpleGrading (((0.1 22 1.5)(0.35 23 7)(0.515 12 1)) GRADING 1)
// 3
// hex (6 7 10 11 0 1 4 5) ( 24 97 1) simpleGrading (((1 9 0.15)(0.1 3 0.9)) GRADING 1)
// hex (7 8 9 10 1 2 3 4) (113 97 1) simpleGrading (((0.1 22 1.5)(0.35 23 7)(0.515 12 1)) GRADING 1)
//-------------------------------------------------------------------
//
// // 1 min = 0.60914299, max = 1.0197701, average = 0.71020364
// hex (6 7 10 11 0 1 4 5) (6 25 1) simpleGrading (((1 9 0.15)(0.1 3 0.9)) 50000 1)
// hex (7 8 9 10 1 2 3 4) (29 25 1) simpleGrading (((0.1 22 1.5)(0.35 23 7)(0.515 12 1)) 50000 1)
//
// // 2
// hex (6 7 10 11 0 1 4 5) (12 49 1) simpleGrading (((1 9 0.15)(0.1 3 0.9)) 50000 1)
// hex (7 8 9 10 1 2 3 4) (57 49 1) simpleGrading (((0.1 22 1.5)(0.35 23 7)(0.515 12 1)) 50000 1)
//
// // 3 patch bottomWall y+ : min = 0.18489745, max = 0.38018561, average = 0.21587743
// hex (6 7 10 11 0 1 4 5) ( 24 97 1) simpleGrading (((1 9 0.15)(0.1 3 0.9)) 50000 1)
// hex (7 8 9 10 1 2 3 4) (113 97 1) simpleGrading (((0.1 22 1.5)(0.35 23 7)(0.515 12 1)) 50000 1)
//
// // 4
// hex (6 7 10 11 0 1 4 5) ( 48 193 1) simpleGrading (((1 9 0.15)(0.1 3 0.9)) 50000 1)
// hex (7 8 9 10 1 2 3 4) (225 193 1) simpleGrading (((0.1 22 1.5)(0.35 23 7)(0.515 12 1)) 50000 1)
// //5 patch bottomWall y+ : min = 0.045097146, max = 0.13949865, average = 0.052922426
// hex (6 7 10 11 0 1 4 5) ( 96 385 1) simpleGrading (((1 9 0.15)(0.1 3 0.9)) 50000 1)
// hex (7 8 9 10 1 2 3 4) (449 385 1) simpleGrading (((0.1 22 1.5)(0.35 23 7)(0.515 12 1)) 50000 1)
);
edges
(
);
boundary
(
inlet
{
type patch;
faces
(
(6 0 5 11)
);
}
outlet
{
type patch;
faces
(
(8 9 3 2)
);
}
topWall
{
type wall;
faces
(
(11 5 4 10)
(10 4 3 9)
);
}
bottomWall
{
type wall;
faces
(
(7 8 2 1)
);
}
symmetry
{
type symmetryPlane;
faces
(
(6 7 1 0)
);
}
frontAndBack
{
type empty;
faces
(
(0 1 4 5)
(1 2 3 4)
(6 11 10 7)
(7 10 9 8)
);
}
);
mergePatchPairs
(
);
// ************************************************************************* //

View File

@ -0,0 +1,68 @@
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: plus |
| \\ / A nd | Web: www.OpenFOAM.com |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class dictionary;
location "system";
object controlDict;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
application simpleFoam;
startFrom startTime;
startTime 0;
stopAt endTime;
endTime 5000;
deltaT 1;
writeControl timeStep;
writeInterval 100;
purgeWrite 1;
writeFormat ascii;
writePrecision 8;
writeCompression off;
timeFormat general;
timePrecision 8;
runTimeModifiable true;
functions
{
minMax
{
type fieldMinMax;
libs ("libfieldFunctionObjects.so");
writeControl timeStep; //writeTime;
fields (U);
}
yPlus
{
type yPlus;
libs ("libfieldFunctionObjects.so");
patches (fixedWall);
writeControl writeTime;
}
#includeFunc "writeCellCentres"
#includeFunc "wallShearStress"
}
// ************************************************************************* //

View File

@ -0,0 +1,51 @@
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: plus |
| \\ / A nd | Web: www.OpenFOAM.com |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.3;
format ascii;
class dictionary;
object decomposeParDict;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
numberOfSubdomains 8 ;
method hierarchical ;
simpleCoeffs
{
n (8 1 1);
delta 0.001;
}
hierarchicalCoeffs
{
n (8 1 1);
delta 0.001;
order xyz;
}
scotchCoeffs
{
processorWeights
(
1
1
1
1
1
1
1
1
);
}
manualCoeffs
{
dataFile ("" );
}
distributed no ;
roots ();

View File

@ -0,0 +1,60 @@
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: plus |
| \\ / A nd | Web: www.OpenFOAM.com |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class dictionary;
location "system";
object fvSchemes;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
ddtSchemes
{
default steadyState;
}
gradSchemes
{
default Gauss linear;
}
divSchemes
{
default none;
div(phi,U) bounded Gauss linearUpwind grad(U);
div(phi,k) bounded Gauss limitedLinear 1;
div(phi,epsilon) bounded Gauss limitedLinear 1;
div(phi,omega) bounded Gauss limitedLinear 1;
div((nuEff*dev2(T(grad(U))))) Gauss linear;
}
laplacianSchemes
{
default Gauss linear uncorrected;
laplacian(DomegaEff,omega) Gauss linear uncorrected;
}
interpolationSchemes
{
default linear;
}
snGradSchemes
{
default uncorrected;
}
wallDist
{
method meshWave;
}
// ************************************************************************* //

View File

@ -0,0 +1,84 @@
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: plus |
| \\ / A nd | Web: www.OpenFOAM.com |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class dictionary;
location "system";
object fvSolution;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
solvers
{
p
{
solver GAMG;
tolerance 1e-10;
relTol 0.1;
smoother DICGaussSeidel;
nPreSweeps 0;
nPostSweeps 2;
cacheAgglomeration on;
agglomerator faceAreaPair;
nCellsInCoarsestLevel 10;
mergeLevels 1;
}
"(U|k|epsilon|R|nuTilda)"
{
solver smoothSolver;
smoother symGaussSeidel;
tolerance 1e-10;
relTol 0.1;
}
omega
{
solver PBiCGStab;
preconditioner DILU;
tolerance 1e-10;
relTol 0.1;
}
}
SIMPLE
{
nNonOrthogonalCorrectors 0;
/*
residualControl
{
p 1e-6;
U 1e-6;
"(k|epsilon|omega)" 1e-6;
}
*/
consistent yes;
}
relaxationFactors
{
equations
{
U 0.9;
k 0.8;
epsilon 0.7;
nuTilda 0.8;
omega 0.8;
}
}
cache
{
grad(U);
}
// ************************************************************************* //