system
blockMeshDict
blockMeshDict defines the configuration for generating mesh.
usually include these items:
- FoamFile: metadata
- scale
- vertices
- blocks: hex, resolution, …
- boundary: boundary conditions for all geometric components
controlDict
controlDict defines the control of time and reading and writing of the solution data. A typical template is like this:
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: v2412 |
| \\ / A nd | Website: www.openfoam.com |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class dictionary;
object controlDict;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
application icoFoam;
startFrom startTime;
startTime 0;
stopAt endTime;
endTime 0.5;
deltaT 0.005;
writeControl timeStep;
writeInterval 20;
purgeWrite 0;
writeFormat ascii;
writePrecision 6;
writeCompression off;
timeFormat general;
timePrecision 6;
runTimeModifiable true;
// ************************************************************************* //
fvSchemes
The user specifies the choice of finite volume discretisation schemes in the fvSchemes dictionary.
fvSolution
The specification of the linear equation solvers and tolerances and other algorithm controls is made in the fvSolution dictionary.
SnapyHexMesh
In Openfoam, mesh generation workflow is like this:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
blockMesh or external mesher
│
▼
┌────────────────┐
│ Background mesh│
└────────────────┘
│
▼
┌────────────────┐
│ snappyHexMesh │◄───────────── Geometry (STL file)
└────────────────┘
│
▼
┌────────────────┐
│ OpenFOAM mesh │
└────────────────┘
refer to this doc.
A snappyHexDict usually contains:
- geometry: store info about stl
- castellatedMeshControls: config about mesh generation
- snapControls
- MeshQualityControls
Here is a template snappyHexDict file:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
FoamFile
{
version 2.0;
format ascii;
class dictionary;
object snappyHexMeshDict;
}
castellatedMesh true;
snap true;
addLayers false;
mergeTolerance 1e-6;
mergePatchFaces yes;
keepPatches yes;
geometry
{
house
{
type triSurfaceMesh;
file "house.stl";
}
}
castellatedMeshControls
{
maxLocalCells 1000000;
maxGlobalCells 2000000;
minRefinementCells 0;
nCellsBetweenLevels 2;
resolveFeatureAngle 30;
allowFreeStandingZoneFaces true;
maxLoadUnbalance 0.10;
features ();
refinementSurfaces
{
house
{
level (1 1);
patchInfo { type wall; }
regions
{
ceiling { level (1 1); patchInfo { type wall; } }
floor { level (1 1); patchInfo { type wall; } }
walls_side { level (1 1); patchInfo { type wall; } }
}
}
}
refinementRegions {}
locationInMesh (40.119041442871094 2.6096878051757812 -74.18577246665954);
}
snapControls
{
nSmoothPatch 5;
tolerance 2.0;
nSolveIter 30;
nRelaxIter 5;
}
addLayersControls
{
relativeSizes true;
layers ();
}
meshQualityControls
{
maxNonOrtho 65;
maxBoundarySkewness 20;
maxInternalSkewness 4;
maxConcave 80;
minVol 1e-13;
minTetQuality 1e-9;
minArea -1;
minTwist 0.02;
minDeterminant 0.001;
minFaceWeight 0.02;
minVolRatio 0.01;
minTriangleTwist -1;
nSmoothScale 4;
errorReduction 0.75;
relaxed { maxNonOrtho 75; }
}
constant
PhysicalProperties
PhysicalProperteis descirbes the physical properties such as Reynolds number
0 (initial values)
store intial values for pressure, temperature, velocity,…
viewer
paraFoam
Some concepts
Patch
A patch is a named collection of boundary faces (the outer skin of your mesh). Each patch appears in constant/polyMesh/boundary and carries a type (e.g. patch, wall, empty, wedge, etc.) and is where you apply boundary conditions in 0/U, 0/p, etc.
Boundary face
Boundary face = a face that has one owner cell (the other side is “outside” the mesh/domain).
Internal face
Internal face = a face shared by two cells (it has an owner and a neighbour). Internal faces are not part of any patch.