Commit 598c49fe authored by Andrew Heather's avatar Andrew Heather
Browse files

TUT: Added new tutorial cases

parent abb59735
#!/bin/sh
cd ${0%/*} || exit 1 # run from this directory
(cd initChannel && ./Allclean)
(cd fullCase && ./Allclean)
#!/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)
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
/*--------------------------------*- 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;
}
}
// ************************************************************************* //
/*--------------------------------*- 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;
}
}
// ************************************************************************* //
/*--------------------------------*- 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;
}
}
// ************************************************************************* //
/*--------------------------------*- 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;
}
}
// ************************************************************************* //
/*--------------------------------*- 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;
}
}
// ************************************************************************* //
#!/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
#!/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)
/*--------------------------------*- 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;
// ************************************************************************* //
/*--------------------------------*- 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
{
}
}
}
// ************************************************************************* //
#!/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
/*--------------------------------*- 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)
);