adding boundaryFoam tutorial to evaluate wall functions

This commit is contained in:
andy
2009-08-13 16:56:59 +01:00
parent 276eeedab0
commit a41b159fbc
19 changed files with 860 additions and 0 deletions

View File

@ -0,0 +1,46 @@
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: 1.6 |
| \\ / A nd | Web: http://www.OpenFOAM.org |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class volVectorField;
object U;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
dimensions [0 1 -1 0 0 0 0];
internalField uniform (1 0 0);
boundaryField
{
lowerWall
{
type fixedValue;
value uniform (0 0 0);
}
upperWall
{
type fixedValue;
value uniform (0 0 0);
}
frontBack
{
type cyclic;
}
defaultFaces
{
type empty;
}
}
// ************************************************************************* //

View File

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

View File

@ -0,0 +1,46 @@
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: 1.6 |
| \\ / A nd | Web: www.OpenFOAM.org |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class volScalarField;
location "0";
object k;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
dimensions [0 2 -2 0 0 0 0];
internalField uniform 0.000000001;
boundaryField
{
lowerWall
{
type kqRWallFunction;
internalField uniform 0.1;
}
upperWall
{
type kqRWallFunction;
internalField uniform 0.1;
}
frontBack
{
type cyclic;
internalField uniform 0.1;
}
defaultFaces
{
type empty;
}
}
// ************************************************************************* //

View File

@ -0,0 +1,44 @@
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: 1.6 |
| \\ / A nd | Web: http://www.OpenFOAM.org |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class volScalarField;
object nuTilda;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
dimensions [0 2 -1 0 0 0 0];
internalField uniform 0;
boundaryField
{
lowerWall
{
type zeroGradient;
}
upperWall
{
type zeroGradient;
}
frontBack
{
type cyclic;
}
defaultFaces
{
type empty;
}
}
// ************************************************************************* //

View File

@ -0,0 +1,46 @@
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: 1.6 |
| \\ / A nd | Web: www.OpenFOAM.org |
| \\/ 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 nutkWallFunction;
value uniform 0;
}
upperWall
{
type nutkWallFunction;
value uniform 0;
}
frontBack
{
type cyclic;
value uniform 0;
}
defaultFaces
{
type empty;
}
}
// ************************************************************************* //

View File

@ -0,0 +1,46 @@
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: 1.6 |
| \\ / A nd | Web: www.OpenFOAM.org |
| \\/ 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 nutkWallFunction;
value uniform 0;
}
upperWall
{
type nutkWallFunction;
value uniform 0;
}
frontBack
{
type cyclic;
value uniform 0;
}
defaultFaces
{
type empty;
}
}
// ************************************************************************* //

View File

@ -0,0 +1,46 @@
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: 1.6 |
| \\ / A nd | Web: www.OpenFOAM.org |
| \\/ 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 nutUSpaldingWallFunction;
value uniform 0;
}
upperWall
{
type nutUSpaldingWallFunction;
value uniform 0;
}
frontBack
{
type cyclic;
value uniform 0;
}
defaultFaces
{
type empty;
}
}
// ************************************************************************* //

View File

@ -0,0 +1,46 @@
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: 1.6 |
| \\ / A nd | Web: www.OpenFOAM.org |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class volScalarField;
location "0";
object omega;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
dimensions [0 0 -1 0 0 0 0];
internalField uniform 1111.11;
boundaryField
{
lowerWall
{
type omegaWallFunction;
value uniform 1111.11;
}
upperWall
{
type omegaWallFunction;
value uniform 1111.11;
}
frontBack
{
type cyclic;
value uniform 1111.11;
}
defaultFaces
{
type empty;
}
}
// ************************************************************************* //

View File

@ -0,0 +1,11 @@
#!/bin/sh
# Source tutorial clean functions
. $WM_PROJECT_DIR/bin/tools/CleanFunctions
cleanCase
rm -rf logs
rm -f *.eps yPlus_vs_uPlus
echo "done"

View File

@ -0,0 +1,69 @@
#!/bin/sh
# Source tutorial run functions
. $WM_PROJECT_DIR/bin/tools/RunFunctions
runApplication blockMesh
exponents="2 3 4 5 6 7 8"
echo "# yPlus vs uPlus" > yPlus_vs_uPlus
for e in $exponents; do
echo " Setting nu to 1e-$e"
sed "s/XXX/$e/g" constant/transportProperties.template \
> constant/transportProperties
runApplication boundaryFoam
mv log.boundaryFoam log.boundaryFoam_$e
# extract y+, U+
# note: both must be added to foamLog.db
runApplication foamLog log.boundaryFoam_$e
mv log.foamLog log.foamLog_$e
if [ -e logs/yPlus_0 ]; then
yPlus=`awk < logs/yPlus_0 'END{print $2}'`
uPlus=`awk < logs/uPlus_0 'END{print $2}'`
echo "$yPlus $uPlus" >> yPlus_vs_uPlus
fi
rm -rf logs
done
# create validation plot
# test if gnuplot exists on the system
type -P gnuplot &>/dev/null || {
echo "gnuplot not found - skipping graph creation" >&2; exit 1;
}
graphName="OF_vs_ANAYTICAL.eps"
echo "Creating graph of u+ vs y+ to $graphName"
gnuplot<<EOF
set terminal postscript eps color enhanced
set output "$graphName"
set grid
set xlabel "y+"
set ylabel "u+"
set key top left
set size 0.75, 0.75
set parametric
# u+ range
set trange [0:35]
# Spaldings law
k=0.41
E=9.8
f(t) = t + 1/E*(exp(k*t) - 1 - k*t*(1 + 0.5*k*t) - 1/6*k*t**3)
set logscale x
set format x "10^{%T}"
plot f(t),t title "Spalding" with lines linetype -1, \
"yPlus_vs_uPlus" title "OpenFOAM" with points lt 1 pt 6
EOF
echo "done"

View File

@ -0,0 +1,14 @@
Test for momentum wall functions
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Computes a series of steady boundary layer calculations, varying the Reynolds
number. Wall u+ plotted as a function of log10(y+), and compared with wall
profile given by Spalding's law.
Usage:
- run test using Allrun script
- uses foamLog to generate u+ and y+ values
- postscript (.eps) plot generated using gnuplot, OF_vs_ANAYTICAL.eps

View File

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

View File

@ -0,0 +1,71 @@
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: 1.6 |
| \\ / A nd | Web: http://www.OpenFOAM.org |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class dictionary;
object blockMeshDict;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
convertToMeters 0.05;
vertices
(
(0 -1 0)
(0 0 0)
(0 1 0)
(0.1 -1 0)
(0.1 0 0)
(0.1 1 0)
(0 -1 0.1)
(0 0 0.1)
(0 1 0.1)
(0.1 -1 0.1)
(0.1 0 0.1)
(0.1 1 0.1)
);
blocks
(
hex (0 3 4 1 6 9 10 7) (1 40 1) simpleGrading (1 1 1)
hex (1 4 5 2 7 10 11 8) (1 40 1) simpleGrading (1 1 1)
);
edges
(
);
patches
(
wall lowerWall
(
(0 3 9 6)
)
wall upperWall
(
(2 8 11 5)
)
cyclic frontBack
(
(0 6 7 1)
(1 7 8 2)
(9 3 4 10)
(10 4 5 11)
)
);
mergePatchPairs
(
);
// ************************************************************************* //

View File

@ -0,0 +1,47 @@
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: dev |
| \\ / A nd | Web: www.OpenFOAM.org |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class polyBoundaryMesh;
location "constant/polyMesh";
object boundary;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
4
(
lowerWall
{
type wall;
nFaces 1;
startFace 79;
}
upperWall
{
type wall;
nFaces 1;
startFace 80;
}
frontBack
{
type cyclic;
nFaces 160;
startFace 81;
featureCos 0.9;
}
defaultFaces
{
type empty;
nFaces 160;
startFace 241;
}
)
// ************************************************************************* //

View File

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

View File

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

View File

@ -0,0 +1,58 @@
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: 1.6 |
| \\ / A nd | Web: www.OpenFOAM.org |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class dictionary;
location "system";
object controlDict;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
application boundaryFoam;
libs
(
"libOpenFOAM.so"
"libinterpolationTables_16x.so"
"libtabulatedWallFunctionFvPatchFields_16x.so"
);
startFrom startTime;
startTime 0;
stopAt endTime;
endTime 1000;
deltaT 1;
writeControl timeStep;
writeInterval 100;
purgeWrite 1;
writeFormat ascii;
writePrecision 6;
writeCompression uncompressed;
timeFormat general;
timePrecision 6;
runTimeModifiable yes;
graphFormat raw;
// ************************************************************************* //

View File

@ -0,0 +1,61 @@
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: 1.6 |
| \\ / A nd | Web: www.OpenFOAM.org |
| \\/ 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) Gauss linear;
div(phi,epsilon) Gauss linear;
div(phi,omega) Gauss linear;
div(phi,R) Gauss linear;
div(phi,nuTilda) Gauss linear;
div((nuEff*dev(grad(U).T()))) Gauss linear;
}
laplacianSchemes
{
default none;
laplacian(nuEff,U) Gauss linear corrected;
laplacian(DkEff,k) Gauss linear corrected;
laplacian(DepsilonEff,epsilon) Gauss linear corrected;
laplacian(DomegaEff,omega) 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,88 @@
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: 1.6 |
| \\ / A nd | Web: www.OpenFOAM.org |
| \\/ 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
{
solver PBiCG;
preconditioner DILU;
tolerance 1e-06;
relTol 0;
}
epsilon
{
solver PBiCG;
preconditioner DILU;
tolerance 1e-06;
relTol 0;
}
omega
{
solver PBiCG;
preconditioner DILU;
tolerance 1e-06;
relTol 0;
}
R
{
solver PBiCG;
preconditioner DILU;
tolerance 1e-06;
relTol 0;
}
nuTilda
{
solver PBiCG;
preconditioner DILU;
tolerance 1e-06;
relTol 0;
}
}
PISO
{
nCorrectors 2;
nNonOrthogonalCorrectors 0;
momentumPredictor yes;
fluxGradp no;
}
relaxationFactors
{
U 0.5;
k 0.7;
epsilon 0.7;
omega 0.7;
R 0.7;
nuTilda 0.7;
}
// ************************************************************************* //