Go back to Richel Bilderbeek's homepage.
Go back to Richel Bilderbeek's OpenFOAM page.
OpenFOAM example1 is an
OpenFOAM example that demonstrates
the minimum requirements to create a (uniform) mesh of a cube using the tool blockMesh.exe
blockMesh needs two files: constant/PolyMesh/blockMeshDict and system/controlDict
(no idea where it needs the second file for).
The file case.foam is an empty file, needed by ParaView to accept this folder.
See the files for comments
After calling blockMesh.exe, the files 'boundary', 'faces', 'neighbour', 'owner' and 'points'
are created, in the folder 'constants/polyMesh'. ParaView can be be used to open 'case.foam' and display the resulting mesh. Click on 'Properties | Apply' on the left, to view the mesh.
./ToolOpenFoamExample1/case.foam
./ToolOpenFoamExample1/ToolOpenFoamExample1.bat
./ToolOpenFoamExample1/system/controlDict
FoamFile
{
version 2.0;
format ascii;
class dictionary;
location "system";
object controlDict;
}
application icoFoam;
startFrom startTime;
startTime 0;
stopAt endTime;
endTime 1.0;
deltaT 0.1;
writeControl timeStep;
//Write to file every timestep
writeInterval 1;
purgeWrite 0;
writeFormat ascii;
writePrecision 6;
writeCompression off;
timeFormat general;
timePrecision 6;
runTimeModifiable true;
|
./ToolOpenFoamExample1/constant/polyMesh/blockMeshDict
FoamFile
{
version 2.0;
format ascii;
class dictionary;
object blockMeshDict;
}
//The unit of the vertices is 1.0 meter
convertToMeters 1.0;
//A cube with the following vertex indices:
//
// 7-----6
// /| /|
// 4-----5 |
// | | | |
// | 3---|-2
// |/ |/
// 0-----1
//
//Each vertex is of the form (x y z)
//
//The local coordinate system is defined by the order in which the vertices are presented in the block definition according to:
//- the axis origin is the first entry in the block definition, vertex 0 in our example;
//- the x direction is described by moving from vertex 0 to vertex 1;
//- the y direction is described by moving from vertex 1 to vertex 2;
//- vertices 0, 1, 2, 3 define the plane z
//- vertex 4 is found by moving from vertex 0 in the z direction;
//- vertices 5,6 and 7 are similarly found by moving in the z direction from vertices 1,2 and 3
vertices
(
(0 0 0)
(1 0 0)
(1 1 0)
(0 1 0)
(0 0 1)
(1 0 1)
(1 1 1)
(0 1 1)
);
//Ordered list of vertex labels and mesh size
blocks
(
hex //The shape is always hex, as blocks are always hexahedra
(0 1 2 3 4 5 6 7) // vertex numbers
(10 10 10) // numbers of cells in each direction
simpleGrading (1 1 1) // cell expansion ratios
);
//Used to describe arc or spline edges
//Keyword selection | Description | Additional entries
//- arc | Circular arc | Single interpolation point
//- simpleSpline | Spline curve | List of interpolation points
//- polyLine | Set of lines | List of interpolation points
//- polySpline | Set of splines | List of interpolation points
//- line | Straight line |
edges
(
);
//List of patches
//Do not uncomment this 'patches' part:
//it will result in a 'undefined faces' warning
//patches
//(
//Possible values are:
//- symmetryPlane
//- patch
//);
boundary
(
//There are multiple boundary types:
//- movingWall:
//- fixedWalls:
//- frontAndBack: for two dimensional meshes
//- inlet
//- outlet
//- walls
my_cube_faces
{
//There are multiple types:
//- wall:
//- patch
//- cyclic
type patch;
//The vertices that make up the six faces of the cube
//
//Each block face is defined by a list of 4 vertex numbers.
//The order in which the vertices are given must be such that,
//looking from inside the block and starting with any vertex,
//the face must be traversed in a clockwise direction to define the other vertices.
faces
(
//bottom
(0 3 2 1)
//left
(0 4 7 3)
//front
(1 5 4 0)
//right
(2 6 5 1)
//back
(3 7 6 2)
//top
(4 5 6 7)
);
}
);
//List of patches to be merged
//mergePatchPairs
//(
//
//);
|
Go back to Richel Bilderbeek's OpenFOAM page.
Go back to Richel Bilderbeek's homepage.

This page has been created by the tool CodeToHtml