TUT: Added simpleFoam/rotatingCylinders validation case - fixes #2563

This commit is contained in:
Andrew Heather
2023-01-03 14:44:20 +00:00
parent 0031cb1efa
commit 51ed7a6034
11 changed files with 524 additions and 0 deletions

View File

@ -0,0 +1,39 @@
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: v2212 |
| \\ / A nd | Website: 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 (0 0 0);
boundaryField
{
innerWall
{
type noSlip;
}
outerWall
{
type noSlip;
}
frontAndBack
{
type empty;
}
}
// ************************************************************************* //

View File

@ -0,0 +1,34 @@
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: v2212 |
| \\ / A nd | Website: 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
{
"innerWall|outerWall"
{
type zeroGradient;
}
frontAndBack
{
type empty;
}
}
// ************************************************************************* //

View File

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

View File

@ -0,0 +1,30 @@
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: v2212 |
| \\ / A nd | Website: www.openfoam.com |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class dictionary;
location "constant";
object MRFProperties;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
MRF1
{
cellZone all;
active yes;
nonRotatingPatches (outerWall);
origin (0 0 0);
axis (0 0 1);
omega 100;
}
// ************************************************************************* //

View File

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

View File

@ -0,0 +1,20 @@
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: v2212 |
| \\ / A nd | Website: www.openfoam.com |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class dictionary;
location "constant";
object turbulenceProperties;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
simulationType laminar;
// ************************************************************************* //

View File

@ -0,0 +1,42 @@
#!/bin/sh
# Require gnuplot
command -v gnuplot >/dev/null || {
echo "FOAM FATAL ERROR: gnuplot not found - skipping graph creation" 1>&2
exit 1
}
gnuplot<<EOF
set terminal pngcairo font "helvetica,16" size 800,600
set xlabel "Radius, r"
set xrange [1:2]
set grid
Omega1 = 100.
Omega2 = 0.
R1 = 1.
R2 = 2.
mu = Omega2/Omega1
A = Omega1*(1. - R2*R2*mu/R1/R1)/(1. - R2*R2/R1/R1)
B = R1*R1*Omega1*(1. - mu)/(1. - R1*R1/R2/R2)
analytical_utheta(r) = A*r + B/r
C = 0.5*A*A*R1*R1 + 2.*A*B*log(R1) - 0.5*B*B/R1/R1
analytical_p(r) = 0.5*A*A*r*r + 2.*A*B*log(r) - 0.5*B*B/r/r - C
set ylabel "Pressure, p"
set output "p.png"
set samples 20
set key bottom right
plot "postProcessing/sample1/1000/centreLine_p.xy" w lines lw 2 lc "black" t "OpenFOAM", \
analytical_p(x) w p ps 2 pt 6 lw 2 lc rgb "red" t "analytical"
set ylabel "U_{/Symbol q}, rad/s"
set output "Utheta.png"
set samples 20
set key top right
plot "postProcessing/sample1/1000/centreLine_U_U:Transformed.xy" u 1:6 w lines lw 2 lc "black" t "OpenFOAM", \
analytical_utheta(x) w p ps 2 pt 6 lw 2 lc rgb "red" t "analytical"
EOF

View File

@ -0,0 +1,126 @@
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: v2212 |
| \\ / A nd | Website: www.openfoam.com |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class dictionary;
object blockMeshDict;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
scale 1;
geom
{
r0 1;
r1 2;
nr 40;
ntheta 40;
g 10;
mr0 #eval{ - $r0 };
mr1 #eval{ - $r1 };
invG #eval{ 1./$g };
}
vertices
(
( $:geom.r0 0 0)
( 0 $geom.r0 0)
($:geom.mr0 0 0)
( 0 $geom.mr0 0)
( $:geom.r1 0 0)
( 0 $geom.r1 0)
($:geom.mr1 0 0)
( 0 $geom.mr1 0)
( $:geom.r0 0 1)
( 0 $geom.r0 1)
($:geom.mr0 0 1)
( 0 $geom.mr0 1)
( $:geom.r1 0 1)
( 0 $geom.r1 1)
($:geom.mr1 0 1)
( 0 $geom.mr1 1)
);
blockInfo
all
($:geom.ntheta $:geom.nr 1)
simpleGrading (1 ((0.5 0.5 $:geom.g)(0.5 0.5 $:geom.invG)) 1);
blocks
(
hex (1 0 4 5 9 8 12 13) $blockInfo
hex (2 1 5 6 10 9 13 14) $blockInfo
hex (3 2 6 7 11 10 14 15) $blockInfo
hex (0 3 7 4 8 11 15 12) $blockInfo
);
edges
(
arc 0 1 origin (0 0 0)
arc 1 2 origin (0 0 0)
arc 2 3 origin (0 0 0)
arc 3 0 origin (0 0 0)
arc 8 9 origin (0 0 1)
arc 9 10 origin (0 0 1)
arc 10 11 origin (0 0 1)
arc 11 8 origin (0 0 1)
arc 4 5 origin (0 0 0)
arc 5 6 origin (0 0 0)
arc 6 7 origin (0 0 0)
arc 7 4 origin (0 0 0)
arc 12 13 origin (0 0 1)
arc 13 14 origin (0 0 1)
arc 14 15 origin (0 0 1)
arc 15 12 origin (0 0 1)
);
defaultPatch
{
name frontAndBack;
type empty;
}
boundary
(
innerWall
{
type wall;
faces
(
(1 0 8 9)
(2 1 9 10)
(3 2 10 11)
(0 3 11 8)
);
}
outerWall
{
type wall;
faces
(
(5 13 12 4)
(6 14 13 5)
(7 15 14 6)
(4 12 15 7)
);
}
);
mergePatchPairs
(
);
// ************************************************************************* //

View File

@ -0,0 +1,93 @@
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: v2212 |
| \\ / A nd | Website: 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 1000;
deltaT 1;
writeControl timeStep;
writeInterval 10;
purgeWrite 3;
writeFormat ascii;
writePrecision 6;
writeCompression off;
timeFormat general;
timePrecision 6;
runTimeModifiable true;
functions
{
transform1
{
type fieldCoordinateSystemTransform;
libs (fieldFunctionObjects);
writeControl writeTime;
fields (U);
coordinateSystem
{
origin (0 0 0);
coordinateRotation
{
type axesRotation;
e3 (0 0 1);
e1 (1 0 0);
}
}
}
sample1
{
type sets;
libs (sampling);
writeControl writeTime;
fields (U p U:Transformed);
interpolationScheme cellPoint;
setFormat raw;
sets
(
centreLine
{
type uniform;
axis x;
start (1 0 0);
end (2 0 0);
nPoints 20;
}
);
}
}
// ************************************************************************* //

View File

@ -0,0 +1,51 @@
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: v2212 |
| \\ / A nd | Website: 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((nuEff*dev2(T(grad(U))))) Gauss linear;
}
laplacianSchemes
{
default Gauss linear corrected;
}
interpolationSchemes
{
default linear;
}
snGradSchemes
{
default corrected;
}
// ************************************************************************* //

View File

@ -0,0 +1,57 @@
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: v2212 |
| \\ / A nd | Website: 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 GaussSeidel;
}
U
{
solver smoothSolver;
smoother GaussSeidel;
tolerance 1e-10;
relTol 0.1;
}
}
SIMPLE
{
nNonOrthogonalCorrectors 0;
pRefCell 0;
pRefValue 0;
}
relaxationFactors
{
fields
{
p 0.3;
}
equations
{
U 0.7;
}
}
// ************************************************************************* //