ENH: Added UserGuide in AsciiDoc
[freefoam.git] / doc / UserGuide / mesh / description.txt
blob3236ce1bc5f42e677b24b143f9371bea84dfb4da
1 [[sec_blockMeshDict]]
2 === Mesh description
3 (((mesh,description)))
5 This section provides a specification of the way the {project} {cpp} classes
6 handle a mesh. The mesh is an integral part of the numerical solution and must
7 satisfy certain criteria to ensure a valid, and hence accurate, solution.
8 During any run, {project} checks that the mesh satisfies a fairly stringent set
9 of validity constraints and will cease running if the constraints are not
10 satisfied. The consequence is that a user may experience some frustration in
11 `correcting' a large mesh generated by third-party mesh generators before
12 {project} will run using it. This is unfortunate but we make no apology for
13 {project} simply adopting good practice to ensure the mesh is valid; otherwise,
14 the solution is flawed before the run has even begun.
16 By default {project} defines a mesh of arbitrary polyhedral cells in 3-D,
17 bounded by arbitrary polygonal faces, 'i.e.' the cells can have an unlimited
18 number of faces where, for each face, there is no limit on the number of edges
19 nor any restriction on its alignment. A mesh with this general structure is
20 known in {project} as a `polyMesh`.(((`polyMesh` class)))(((class,`polyMesh`)))
21 It is sufficient to mention here that this type of mesh offers great freedom in
22 mesh generation and manipulation in particular when the geometry of the domain
23 is complex or changes over time. The price of absolute mesh generality is,
24 however, that it can be difficult to convert meshes generated using
25 conventional tools. The {project} library therefore provides `cellShape` tools
26 to manage conventional mesh formats based on sets of pre-defined cell shapes.
28 ==== Mesh specification and validity constraints
29 (((mesh,specification))) (((mesh,validity constraints)))
31 Before describing the {project} mesh format, `polyMesh`, and the `cellShape`
32 tools, we will first set out the validity constraints used in {project}. The
33 conditions that a mesh must satisfy are:
35 ===== Points
37 A point is a location in 3-D space, defined by a vector in units of metres
38 (math:[\unit{m}]). The points are compiled into a list and each point is
39 referred to by a label, which represents its position in the list, starting
40 from zero. 'The point list cannot contain two different points at an exactly
41 identical position nor any point that is not part at least one face.'
43 ===== Faces
45 A face is an ordered list of points, where a point is referred to by its label.
46 The ordering of point labels in a face is such that each two neighbouring
47 points are connected by an edge, 'i.e.' you follow points as you travel around
48 the circumference of the face. Faces are compiled into a list and each face is
49 referred to by its label, representing its position in the list. The direction
50 of the face normal vector is defined by the right-hand rule, 'i.e.' looking
51 towards a face, if the numbering of the points follows an anti-clockwise path,
52 the normal vector points towards you, as shown in <<fig_faceNumbering>>.
54 [[fig_faceNumbering]]
55 .Face area vector from point numbering on the face
56 image::{builddir}mesh/assets/faceNumbering.{gfx-fmt}[]
58 There are two types of face:
60 *Internal faces*::
61   Those faces that connect two cells (and it can never be more than two). For
62   each internal face, the ordering of the point labels is such that the face
63   normal points into the cell with the larger label, 'i.e.' for cells 2 and 5,
64   the normal points into 5;
65 *Boundary faces*::
66   Those belonging to one cell since they coincide with the boundary of the
67   domain. A boundary face is therefore addressed by one cell(only) and a
68   boundary patch. The ordering of the point labels is such that the face normal
69   points outside of the computational domain.
71 Faces are generally expected to be convex; at the very least the face centre
72 needs to be inside the face. Faces are allowed to be warped, 'i.e.' not all
73 points of the face need to be coplanar.
75 ===== Cells
77 A cell is a list of faces in arbitrary order. Cells must have the properties
78 listed below.
80 *Contiguous*::
81   The cells must completely cover the computational domain and are must not
82   overlap one another.
83 *Convex*::
84   Every cell must be convex and its cell centre inside the cell.
85 *Closed*::
86   Every cell must be 'closed', both geometrically and topologically where:
87   - geometrical closedness requires that when all face area vectors are
88     oriented to point outwards of the cell, their sum should equal the zero
89     vector to machine accuracy;
90   - topological closedness requires that all the edges in a cell are used by
91     exactly two faces of the cell in question.
92 *Orthogonality*::
93 For all internal faces of the mesh, we define the centre-to-centre vector as
94 that connecting the centres of the 2 cells that it adjoins oriented from the
95 the centre of the cell with smaller label to the centre of the cell with larger
96 label. The orthogonality constraint requires that for each internal face, the
97 angle between the face area vector, oriented as described above, and the
98 centre-to-centre vector must always be less than 90&deg;.
100 ===== Boundary
102 A boundary is a list of patches, each of which is associated with a boundary
103 condition. A patch is a list of face labels which clearly must contain only
104 boundary faces and no internal faces. The boundary is required to be closed,
105 'i.e.' the sum all boundary face area vectors equates to zero to machine
106 tolerance.
108 [[sec_polyMesh]]
109 ==== The `polyMesh` description
111 The dirname:constant[] directory contains a full description of the case
112 `polyMesh` (((`polyMesh` class)))(((class,`polyMesh`))) in a subdirectory
113 filename:polyMesh[].(((filename:polyMesh[] directory)))
114 (((directory,filename:polyMesh[]))) The `polyMesh` description is based around
115 faces and, as already discussed, internal cells connect 2 cells and boundary
116 faces address a cell and a boundary patch. Each face is therefore assigned an
117 `owner' cell and `neighbour' cell so that the connectivity across a given face
118 can simply be described by the owner and neighbour cell labels. In the case of
119 boundaries, the connected cell is the owner and the neighbour is assigned the
120 label `-1'. With this in mind, the I/O specification consists of the following
121 files:
123 filename:points[]::
124   (((filename:points[],dictionary)))(((dictionary,filename:points[]))) a list
125   of vectors describing the cell vertices, where the first vector in the list
126   represents vertex 0, the second vector represents vertex 1, 'etc.';
127 filename:faces[]::
128   (((filename:faces[],dictionary)))(((dictionary,filename:faces[]))) a list of
129   faces, each face being a list of indices to vertices in the points list,
130   where again, the first entry in the list represents face 0, 'etc.';
131 filename:owner[]::
132   (((filename:owner[],dictionary)))(((dictionary,filename:owner[]))) a list of
133   owner cell labels, the index of entry relating directly to the index of the
134   face, so that the first entry in the list is the owner label for face 0, the
135   second entry is the owner label for face 1, 'etc.';
136 filename:neighbour[]::
137   (((filename:neighbour[],dictionary)))(((dictionary,filename:neighbour[]))) a
138   list of neighbour cell labels;
139 filename:boundary[]::
140   (((filename:boundary[],dictionary)))(((dictionary,filename:boundary[]))) a
141   list of patches, containing a dictionary entry for each patch, declared using
142   the patch name, 'e.g.'
144 -------------------------------------------------------------------------------
145 movingWall
147     type patch;
148     nFaces 20;
149     startFace 760;
151 -------------------------------------------------------------------------------
153 The `startFace` (((`startFace` keyword)))(((keyword,`startFace`))) is the index
154 into the face list of the first face in the patch, and `nFaces` (((`nFaces`
155 keyword)))(((keyword,`nFaces`))) is the number of faces in the patch.
158 'Note that if the user wishes to know how many cells are in their domain,
159 there is a' `note` 'in the' `FoamFile` 'header of the' filename:owner[] 'file
160 that contains an entry for' `nCells`.
162 ==== The `cellShape` tools
164 We shall describe the alternative `cellShape` tools that may be used
165 particularly when converting some standard (simpler) mesh formats for the use
166 with {project} library.
168 The vast majority of mesh generators and post-processing systems support only a
169 fraction of the possible polyhedral cell shapes in existence. They define a
170 mesh in terms of a limited set of 3D cell geometries, referred to as 'cell
171 shapes'. The {project} library contains definitions of these standard shapes,
172 to enable a conversion of such a mesh into the `polyMesh` format described in
173 the previous section.
175 The `cellShape` models supported by {project} are shown in <<tab_cellShapes>>.
176 The shape is defined by the ordering of point labels in accordance with the
177 numbering scheme contained in the shape model. The ordering schemes for points,
178 faces and edges are shown in <<tab_cellShapes>>. The numbering of the points
179 must not be such that the shape becomes twisted or degenerate into other
180 geometries, 'i.e.' the same point label cannot be used more that once in a
181 single shape. Moreover it is unnecessary to use duplicate points in {project}
182 since the available shapes in {project} cover the full set of degenerate
183 hexahedra.
185 The cell description consists of two parts: the name of a cell model and the
186 ordered list of labels. Thus, using the following list of points
188 -------------------------------------------------------------------------------
191     (0 0 0)
192     (1 0 0)
193     (1 1 0)
194     (0 1 0)
195     (0 0 0.5)
196     (1 0 0.5)
197     (1 1 0.5)
198     (0 1 0.5)
200 -------------------------------------------------------------------------------
202 A hexahedral cell would be written as:
204 -------------------------------------------------------------------------------
205 (hex 8(0 1 2 3 4 5 6 7))
206 -------------------------------------------------------------------------------
208 Here the hexahedral cell shape is declared using the keyword `hex`. Other
209 shapes are described by the keywords listed in <<tab_cellShapes>>.
211 [[tab_cellShapes]]
212 .Vertex, face and edge numbering for ++cellShape++s
213 [grid="none",frame="topbot"]
214 |==============================================================================
215 | image:{builddir}mesh/assets/hexNumbering.{gfx-fmt}[]
216 | (a) Hexahedron: keyword `hex`
217 | image:{builddir}mesh/assets/wedgeNumbering.{gfx-fmt}[]
218 | (b) Wedge: keyword `wedge`
219 | image:{builddir}mesh/assets/prismNumbering.{gfx-fmt}[]
220 | (c) Prism: keyword `prism`
221 | image:{builddir}mesh/assets/pyrNumbering.{gfx-fmt}[]
222 | (d) Pyramid: keyword `pyr`
223 | image:{builddir}mesh/assets/tetNumbering.{gfx-fmt}[]
224 | (e) Tetrahedron: keyword `tet`
225 | image:{builddir}mesh/assets/tetWedgeNumbering.{gfx-fmt}[]
226 | (f) Tetrahedron wedge: keyword `tetWedge`
227 |==============================================================================
229 ==== 1- and 2-dimensional and axi-symmetric problems
230 (((mesh,1-dimensional))) (((mesh,1D))) (((mesh,2-dimensional)))
231 (((mesh,2D))) (((mesh,axi-symmetric))) (((1-dimensional mesh)))
232 (((1D mesh))) (((2-dimensional mesh))) (((2D mesh)))
233 (((axi-symmetric mesh)))
235 {project} is designed as a code for 3-dimensional space and defines all meshes
236 as such. However, 1- and 2- dimensional and axi-symmetric problems can be
237 simulated in {project} by generating a mesh in 3 dimensions and applying
238 special boundary conditions on any patch in the plane(s) normal to the
239 direction(s) of interest. More specifically, 1- and 2- dimensional problems use
240 the `empty` (((`empty`,boundary condition)))(((boundary condition,`empty`)))
241 patch type and axi-symmetric problems use the `wedge`
242 (((`wedge`,boundary condition)))(((boundary condition,`wedge`))) type. The use
243 of both are described in <<sec_baseTypes>> and the generation of wedge
244 geometries for axi-symmetric problems is discussed in
245 <<sec_blocksWithFewerVertices>>.