Commit 6f82273f authored by Chris Greenshields's avatar Chris Greenshields
Browse files

Template case files to help general setup of OpenFOAM cases

The templates include a stategy to simplify meshing with snappyHexMesh,
particularly to help generate an initial mesh quickly that can subsequently be
improved.  The templates are setup to enable rapid initial simulations, typically
with simpleFoam.  The initial templates cover simple inflow-outflow and closed
domains, including rotating geometry, and an example axisymmetric flow.  For
more details, consult the README file accompanying each template case.
The cases are located in $FOAM_ETC/templates
parent 93b3113b
/*--------------------------------*- 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 volVectorField;
object U;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
Uinlet (10 0 0);
dimensions [0 1 -1 0 0 0 0];
internalField uniform (0 0 0);
boundaryField
{
inlet
{
type fixedValue;
value uniform $Uinlet;
}
atmosphere
{
type pressureInletOutletVelocity;
value uniform (0 0 0);
}
#includeEtc "caseDicts/setConstraintTypes"
}
// ************************************************************************* //
/*--------------------------------*- 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 volScalarField;
object omega;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
epsilonInlet 0.002;
dimensions [0 2 -3 0 0 0 0];
internalField uniform $epsilonInlet;
boundaryField
{
"(inlet|atmosphere)"
{
type turbulentMixingLengthDissipationRateInlet;
mixingLength 0.1;
value uniform $epsilonInlet;
}
#includeEtc "caseDicts/setConstraintTypes"
}
// ************************************************************************* //
/*--------------------------------*- 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 volScalarField;
object k;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
kInlet 0.01;
dimensions [0 2 -2 0 0 0 0];
internalField uniform $kInlet;
boundaryField
{
inlet
{
type turbulentIntensityKineticEnergyInlet;
intensity 0.02;
value uniform $kInlet;
}
atmosphere
{
type inletOutlet;
inletValue uniform $kInlet;
value uniform $kInlet;
}
#includeEtc "caseDicts/setConstraintTypes"
}
// ************************************************************************* //
/*--------------------------------*- 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 volScalarField;
object nut;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
dimensions [0 2 -1 0 0 0 0];
internalField uniform 0;
boundaryField
{
inlet
{
type calculated;
value uniform 0;
}
atmosphere
{
type calculated;
value uniform 0;
}
#includeEtc "caseDicts/setConstraintTypes"
}
// ************************************************************************* //
/*--------------------------------*- 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 volScalarField;
object omega;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
omegaInlet 1.0;
dimensions [0 0 -1 0 0 0 0];
internalField uniform $omegaInlet;
boundaryField
{
"(inlet|atmosphere)"
{
type turbulentMixingLengthFrequencyInlet;
mixingLength 0.1;
value uniform $omegaInlet;
}
#includeEtc "caseDicts/setConstraintTypes"
}
// ************************************************************************* //
/*--------------------------------*- 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 volScalarField;
object p;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
dimensions [0 2 -2 0 0 0 0];
internalField uniform 0;
boundaryField
{
inlet
{
type zeroGradient;
}
atmosphere
{
type totalPressure;
gamma 1.4;
p0 uniform 0;
}
#includeEtc "caseDicts/setConstraintTypes"
}
// ************************************************************************* //
#!/bin/sh
cd ${0%/*} || exit 1 # run from this directory
# Source tutorial clean functions
. $WM_PROJECT_DIR/bin/tools/CleanFunctions
cleanCase
rm constant/polyMesh/boundary
#!/bin/sh
cd ${0%/*} || exit 1 # run from this directory
# Source tutorial run functions
. $WM_PROJECT_DIR/bin/tools/RunFunctions
application=`getApplication`
runApplication blockMesh
runApplication extrudeMesh
runApplication $application
# ----------------------------------------------------------------- end-of-file
Overview
========
+ Template case for axisymmetric jet flow
+ The main purpose of this template is to demonstrate a simple, reliable meshing
strategy for axisymmetric flow
Meshing
=======
+ The blockMeshDict file contains a backgroundMesh subditionary
+ In backgroundMesh set the geometry radius and length and jet radius
+ Set the number of cells in the length and radial directions
+ Run blockMesh to generate a 2D "slab" mesh
+ Run extrudeMesh to convert the mesh into a 2D axisymmetric mesh with wedge
front and back patches
Initialisation
==============
+ In the field files in the 0 directory, set inlet values
+ For example, in 0/U, set the inlet velocity Uinlet
+ Set the viscosity in constant/transportProperties
Output
======
+ Graph data of field values along the centreline are written to files in
postProcessing/graph
\ No newline at end of file
/*--------------------------------*- 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;
object RASProperties;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
RASModel kOmegaSST;
turbulence on;
printCoeffs on;
// ************************************************************************* //
/*--------------------------------*- 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;
object blockMeshDict;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
backgroundMesh
{
length 25;
rA 0.5; // radius of inlet patch
rB 4; // outer radius
lengthCells 250;
rAcells 10;
rBcells 50;
}
convertToMeters 1;
vertices
(
( 0 0 -1)
($:backgroundMesh.length 0 -1)
( 0 $:backgroundMesh.rA -1)
($:backgroundMesh.length $:backgroundMesh.rA -1)
( 0 $:backgroundMesh.rB -1)
($:backgroundMesh.length $:backgroundMesh.rB -1)
( 0 0 0)
($:backgroundMesh.length 0 0)
( 0 $:backgroundMesh.rA 0)
($:backgroundMesh.length $:backgroundMesh.rA 0)
( 0 $:backgroundMesh.rB 0)
($:backgroundMesh.length $:backgroundMesh.rB 0)
);
blocks
(
hex (0 1 3 2 6 7 9 8)
($:backgroundMesh.lengthCells $:backgroundMesh.rAcells 1)
simpleGrading (1 1 1)
hex (2 3 5 4 8 9 11 10)
($:backgroundMesh.lengthCells $:backgroundMesh.rBcells 1)
simpleGrading (1 1 1)
);
edges
(
);
boundary
(
inlet
{
type patch;
faces
(
(0 6 8 2)
);
}
front
{
type symmetry;
faces
(
(6 7 9 8)
(8 9 11 10)
);
}
back
{
type symmetry;
faces
(
(0 1 3 2)
(2 3 5 4)
);
}
atmosphere
{
type patch;
faces
(
(2 8 10 4)
(4 5 11 10)
(5 3 9 11)
(3 1 7 9)
);
}
);
mergePatchPairs
(
);
// ************************************************************************* //
/*--------------------------------*- 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;
object transportProperties;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
transportModel Newtonian;
nu nu [ 0 2 -1 0 0 0 0 ] 1.5e-05;
// ************************************************************************* //
/*--------------------------------*- 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;
object turbulenceProperties;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
simulationType RASModel;
// ************************************************************************* //
/*--------------------------------*- 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;
object controlDict;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
application simpleFoam;
startFrom latestTime;
startTime 0;
stopAt endTime;
endTime 1000;
deltaT 1;
writeControl timeStep;
writeInterval 50;
purgeWrite 0;
writeFormat ascii;
writePrecision 12;
writeCompression off;
timeFormat general;
timePrecision 6;
runTimeModifiable true;
// adjustTimeStep yes;
// maxCo 1;
functions
{
#include "graph"
}
// ************************************************************************* //
/*--------------------------------*- 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;
object extrudeProperties;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
constructFrom patch;
sourceCase "$FOAM_CASE";
sourcePatches (front);
exposedPatchName back;
extrudeModel wedge;
sectorCoeffs
{
axisPt (0 0 0);
axis (1 0 0);
angle 1;
}
flipNormals false;
mergeFaces false;
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
/*--------------------------------*- 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;
object fvSchemes;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
ddtSchemes
{
default steadyState;
}
gradSchemes
{
default Gauss linear;
limited cellLimited Gauss linear 1;
grad(U) $limited;
grad(k) $limited;
grad(omega) $limited;
}
divSchemes
{
default none;
div(phi,U) bounded Gauss linearUpwind limited;
turbulence bounded Gauss limitedLinear 1;
div(phi,k) $turbulence;
div(phi,omega) $turbulence;
div(phi,epsilon) $turbulence;
div((nuEff*dev(T(grad(U))))) Gauss linear;
}
laplacianSchemes
{
default Gauss linear corrected;
}
interpolationSchemes
{
default linear;
}
snGradSchemes
{
default corrected;
}
fluxRequired
{
default no;
p ;
}
// ************************************************************************* //
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: dev |