TUT: Added new bump2D case

This commit is contained in:
Andrew Heather
2018-12-18 19:08:03 +00:00
parent 485523eab5
commit 79f9c3bb7d
14 changed files with 912 additions and 0 deletions

View File

@ -0,0 +1,57 @@
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: v1806 |
| \\ / 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.44 0 0);
boundaryField
{
inlet
{
type fixedValue;
value $internalField;
}
outlet
{
type inletOutlet;
inletValue uniform (0 0 0);
value $internalField;
}
top
{
type symmetryPlane;
}
"(symUp|symDown)"
{
type symmetryPlane;
}
bump
{
type noSlip;
}
frontAndBack
{
type empty;
}
}
// ************************************************************************* //

View File

@ -0,0 +1,59 @@
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: v1806 |
| \\ / 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 6.93e-5; // 3*nu_inf
boundaryField
{
inlet
{
type fixedValue;
value $internalField;
}
outlet
{
type inletOutlet;
inletValue $internalField;
value $internalField;
}
top
{
type symmetryPlane;
}
"(symUp|symDown)"
{
type symmetryPlane;
}
bump
{
type fixedValue;
value uniform 0;
}
frontAndBack
{
type empty;
}
}
// ************************************************************************* //

View File

@ -0,0 +1,58 @@
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: v1806 |
| \\ / A nd | Web: www.OpenFOAM.com |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class volScalarField;
object nut;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
dimensions [0 2 -1 0 0 0 0];
internalField uniform 4.86e-6;
boundaryField
{
inlet
{
type calculated;
value $internalField;
}
outlet
{
type calculated;
value $internalField;
}
top
{
type symmetryPlane;
}
"(symUp|symDown)"
{
type symmetryPlane;
}
bump
{
type fixedValue;
value uniform 0;
}
frontAndBack
{
type empty;
}
}
// ************************************************************************* //

View File

@ -0,0 +1,60 @@
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: v1806 |
| \\ / 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 5220.8;
boundaryField
{
inlet
{
type fixedValue;
value $internalField;
}
outlet
{
type inletOutlet;
inletValue $internalField;
value $internalField;
}
top
{
type symmetryPlane;
}
"(symUp|symDown)"
{
type symmetryPlane;
}
bump
{
type omegaWallFunction;
value $internalField;
}
frontAndBack
{
type empty;
}
}
// ************************************************************************* //

View File

@ -0,0 +1,56 @@
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: v1806 |
| \\ / 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 $internalField;
}
top
{
type symmetryPlane;
}
"(symUp|symDown)"
{
type symmetryPlane;
}
bump
{
type zeroGradient;
}
frontAndBack
{
type empty;
}
}
// ************************************************************************* //

View File

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

View File

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

View File

@ -0,0 +1,31 @@
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: v1806 |
| \\ / 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;
RASModel SpalartAllmaras;
turbulence on;
printCoeffs on;
}
// ************************************************************************* //

View File

@ -0,0 +1,104 @@
#!/bin/sh
# Note: CFL3D data available from:
# https://turbmodels.larc.nasa.gov/bump_sa.html
cd ${0%/*} || exit 1 # run from this directory
. $WM_PROJECT_DIR/bin/tools/RunFunctions # Tutorial run functions
#set -x
plotTau() {
graphNameTau="hill2D_tau.png"
echo "Creating wallshear stress graph to $graphNameTau"
gnuplot<<PLT_TAU
set terminal pngcairo font "helvetica,20" size 1000, 1000
set xrange [0:1.5]
set yrange [0:0.008]
set grid
set key bottom right
set xlabel "x"
set ylabel "c_f"
set output "$graphNameTau"
Uref = 69.44
set lmargin 10
set rmargin 1.5
set bmargin 3.2
# plot \
# "profiles.dat" u 1:(sqrt(\$2*\$2+\$3*\$3+\$4*\$4)/(0.5*Uref*Uref)) \
# t "simpleFoam" w l lw 2 lc rgb "black", \
# "cf_bump_cfl3d_sa.dat" every 10 u 1:2 \
# t "CFL3D" w p ps 3 pt 6 lw 2 lc rgb "red"
plot \
"profiles.dat" u 1:(sqrt(\$2*\$2+\$3*\$3+\$4*\$4)/(0.5*Uref*Uref)) \
t "simpleFoam" w l lw 2 lc rgb "black"
PLT_TAU
}
plotCp() {
graphNameCp="hill2D_cp.png"
echo "Creating pressure coefficient graph to $graphNameCp"
gnuplot<<PLT_CP
set terminal pngcairo font "helvetica,20" size 1000, 1000
set xrange [0:1.5]
set yrange [0.4:-0.8]
set grid
set key bottom right
set xlabel "x"
set ylabel "c_p"
set output "$graphNameCp"
Uref = 69.44
set lmargin 10
set rmargin 1.5
set bmargin 3.2
# plot \
# "profiles.dat" u 1:5 \
# t "simpleFoam" w l lw 2 lc rgb "black", \
# "cp_bump_cfl3d_sa.dat" every 10 u 1:2 \
# t "CFL3D" w p ps 3 pt 6 lw 2 lc rgb "red"
plot \
"profiles.dat" u 1:5 \
t "simpleFoam" w l lw 2 lc rgb "black"
PLT_CP
}
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
}
# 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
}
timeDir=$(foamListTimes -latestTime)
echo "# ccx tau_xx tau_yy tau_zz cp" > profiles.dat
foamDictionary -entry boundaryField.bump.value -value $timeDir/Cx | \
sed -n '/(/,/)/p' | sed -e 's/[()]//g;/^\s*$/d' > Cx.$$
foamDictionary -entry boundaryField.bump.value -value $timeDir/wallShearStress | \
sed -n '/(/,/)/p' | sed -e 's/[()]//g;/^\s*$/d' > tau.$$
foamDictionary -entry boundaryField.bump.value -value $timeDir/Cp | \
sed -n '/(/,/)/p' | sed -e 's/[()]//g;/^\s*$/d' > cp.$$
paste -d ' ' Cx.$$ tau.$$ cp.$$ >> profiles.dat
plotTau
plotCp
\rm -f Cx.$$ tau.$$ cp.$$ profiles.dat
fi

View File

@ -0,0 +1,191 @@
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: v1806 |
| \\ / A nd | Web: www.OpenFOAM.com |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class dictionary;
object blockMeshDict;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
scale 1;
vertices
(
( -25.0 0 1 ) // 0
( 0 0 1 ) // 1
( 0.3 0 1 ) // 2
( 1.2 0 1 ) // 3
( 1.5 0 1 ) // 4
( 26.5 0 1 ) // 5
( 26.5 5 1 ) // 6
( 1.5 5 1 ) // 7
( 1.2 5 1 ) // 8
( 0.3 5 1 ) // 9
( 0 5 1 ) // 10
( -25.0 5 1 ) // 11
( -25.0 0 -1 ) // 12
( 0 0 -1 ) // 13
( 0.3 0 -1 ) // 14
( 1.2 0 -1 ) // 15
( 1.5 0 -1 ) // 16
( 26.5 0 -1 ) // 17
( 26.5 5 -1 ) // 18
( 1.5 5 -1 ) // 19
( 1.2 5 -1 ) // 20
( 0.3 5 -1 ) // 21
( 0 5 -1 ) // 22
( -25.0 5 -1 ) // 23
);
blocks
(
// Medium level for tutorial
hex ( 0 1 13 12 11 10 22 23) (30 1 81) simpleGrading (0.002 1 20000)
hex ( 1 2 14 13 10 9 21 22) (25 1 81) simpleGrading (2 1 20000)
hex ( 2 3 15 14 9 8 20 21) (60 1 81) simpleGrading (1 1 20000)
hex ( 3 4 16 15 8 7 19 20) (25 1 81) simpleGrading (0.5 1 20000)
hex ( 4 5 17 16 7 6 18 19) (30 1 81) simpleGrading (500 1 20000)
// Fine
//hex ( 0 1 13 12 11 10 22 23) (240 1 648) simpleGrading (0.002 1 20000)
//hex ( 1 2 14 13 10 9 21 22) (200 1 648) simpleGrading (2 1 20000)
//hex ( 2 3 15 14 9 8 20 21) (480 1 648) simpleGrading (1 1 20000)
//hex ( 3 4 16 15 8 7 19 20) (200 1 648) simpleGrading (0.5 1 20000)
//hex ( 4 5 17 16 7 6 18 19) (240 1 648) simpleGrading (500 1 20000)
);
edges #codeStream
{
codeInclude
#{
#include "pointField.H"
#include "mathematicalConstants.H"
#};
code
#{
const scalar xMin = 0.3;
const scalar xMax = 1.2;
const label nPoints = 100;
const scalar dx = (xMax - xMin)/scalar(nPoints - 1);
os << "(" << nl << "spline 2 3" << nl;
pointField profile(nPoints);
const scalar pi = constant::mathematical::pi;
for (label i = 0; i < nPoints; ++i)
{
scalar x = xMin + i*dx;
profile[i].x() = x;
profile[i].y() = 0.05*pow4(sin(pi*x/0.9 - (pi/3)));
profile[i].z() = 1;
}
os << profile << nl;
os << "spline 14 15" << nl;
profile.replace(2, -1);
os << profile << nl;
os << ");" << nl;
#};
};
boundary
(
inlet
{
type patch;
faces
(
(0 11 23 12)
);
}
outlet
{
type patch;
faces
(
(17 18 6 5)
);
}
top
{
type symmetryPlane;
faces
(
(11 10 22 23)
(10 9 21 22)
( 9 8 20 21)
( 8 7 19 20)
( 7 6 18 19)
);
}
symUp
{
type symmetryPlane;
faces
(
( 0 12 13 1)
);
}
bump
{
type wall;
faces
(
( 1 13 14 2)
( 2 14 15 3)
( 3 15 16 4)
);
}
symDown
{
type symmetryPlane;
faces
(
( 4 16 17 5)
);
}
frontAndBack
{
type empty;
faces
(
(12 23 22 13)
(13 22 21 14)
(14 21 20 15)
(15 20 19 16)
(16 19 18 17)
( 0 11 10 1)
( 1 10 9 2)
( 2 9 8 3)
( 3 8 7 4)
( 4 7 6 5)
);
}
);
mergePatchPairs
(
);
// ************************************************************************* //

View File

@ -0,0 +1,113 @@
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: v1806 |
| \\ / 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 10000;
deltaT 1;
writeControl timeStep;
writeInterval 100;
purgeWrite 3;
writeFormat ascii;
writePrecision 8;
writeCompression off;
timeFormat general;
timePrecision 8;
runTimeModifiable true;
functions
{
pressure
{
type pressure;
libs ("libfieldFunctionObjects.so");
writeControl writeTime;
result Cp;
calcTotal no;
calcCoeff yes;
rho rhoInf;
rhoInf 1;
U UInf;
UInf (69.44 0 0);
pInf 0;
}
forceCoeffs
{
libs ("libforces.so");
type forceCoeffs;
writeControl writeTime;
rho rhoInf;
rhoInf 1;
liftDir (0 1 0);
dragDir (1 0 0);
CofR (0.75 0 0); // bump midpoint
pitchAxis (0 0 1);
magUInf 69.44;
lRef 0.9; // length of bump
Aref 0.1; // mesh span = 2, bump height = 0.05; 2*0.05=0.1
patches (bump);
}
wallShearStress
{
type wallShearStress;
libs ("libfieldFunctionObjects.so");
writeControl writeTime;
patches (bump);
}
yPlus
{
type yPlus;
libs ("libfieldFunctionObjects.so");
writeControl writeTime;
patches (bump);
}
cellCentres
{
type writeCellCentres;
libs ("libfieldFunctionObjects.so");
writeControl writeTime;
}
residuals
{
type residuals;
libs ("libutilityFunctionObjects.so");
fields (".*");
}
}
// ************************************************************************* //

View File

@ -0,0 +1,28 @@
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: v1806 |
| \\ / 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,60 @@
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: v1806 |
| \\ / 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,epsilon) bounded Gauss upwind;
div(phi,omega) bounded Gauss upwind;
div(phi,k) bounded Gauss upwind;
div(phi,nuTilda) bounded Gauss upwind;
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,64 @@
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: v1806 |
| \\ / A nd | Web: www.OpenFOAM.com |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class dictionary;
location "system";
object fvSolution;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
solvers
{
p
{
solver GAMG;
smoother DICGaussSeidel;
tolerance 1e-08;
relTol 0.1;
}
"(U|k|epsilon|omega|nuTilda)"
{
solver PBiCGStab;
preconditioner DILU;
tolerance 1e-8;
relTol 0;
}
}
SIMPLE
{
nNonOrthogonalCorrectors 0;
consistent yes;
residualControl
{
p 1e-5;
U 1e-5;
"(k|epsilon|omega|nuTilda)" 1e-5;
}
}
relaxationFactors
{
equations
{
U 0.9;
"(k|epsilon|omega|nuTilda)" 0.7;
}
}
cache
{
grad(U);
}
// ************************************************************************* //