Appendix B. Mesh File Format
Appendix B. Mesh File Format
This document describes the content and format of TGrid and FLUENT mesh files. These
files are broken into several sections depending on the following guidelines:
Each section is enclosed in parentheses and begins with an integer (in decimal)
indicating its type.
All groups of items are enclosed in parentheses. This makes skipping to ends of
(sub)sections and parsing them very easy. It also allows for easy and compatible
addition of new items in future releases.
Grid sections are stored in the case file. A grid file is a subset of a case file, containing
only those sections pertaining to the grid. Following are descriptions of the currently
defined grid sections.
The section ID numbers are indicated below in both symbolic and numeric forms. The
symbolic representations are available as symbols in a Scheme source file (xfile.scm),
or as macros in a C header file (xfile.h); both of these are available from Fluent Inc.
B.1 Comment
Index: 0
Scheme symbol: xf-comment
C macro: XF COMMENT
Codes: FLUENT, TGrid
Status: optional
Comment sections can appear anywhere in the file (except within other sections), and
appear as
(0 "comment text")
c Fluent Inc. January 7, 2004 B-1
Mesh File Format
For example,
(0 "Variables:")
(37 (
(relax-mass-flow 1)
(default-coefficient ())
(default-method 0)
))
B.2 Header
Index: 1
Scheme symbol: xf-header
C macro: XF HEADER
Codes: FLUENT, TGrid
Status: optional
Header sections can appear anywhere in the file (except within other sections), and appear
as
(1 "TGrid ND 3.5.1")
where N is 2 or 3. The purpose of this section is to identify the program that wrote
the file. Although it can appear anywhere, it is typically one of the first sections in the
file. Additional header sections indicate other programs that may have been used in
generating the file and thus provide a history mechanism showing where the file came
from and how it was processed.
B.3 Dimensions
Index: 2
Scheme symbol: xf-dimension
C macro: XF DIMENSION
Codes: FLUENT, TGrid
Status: optional
(2 ND)
where ND is 2 or 3. This section is currently supported as a check that the grid has the
appropriate dimensionality.
B-2
c Fluent Inc. January 7, 2004
B.4 Nodes
B.4 Nodes
Index: 10
Scheme symbol: xf-node
C macro: XF NODE
Codes: FLUENT, TGrid
Status: required
If zone-id is zero, this is a declaration section providing the total number of nodes in
the grid. first-index will then be one, last-index will be the total number of nodes
in hexadecimal, type is meaningless, ND is the dimensionality of the grid, and there are
no coordinates following. The parentheses for the coordinates are not there either. For
example,
If zone-id is greater than zero, it indicates the zone to which the nodes belong. first-index
and last-index are then the indices of the nodes in the zone, in hexadecimal. Of course,
last-index in each zone must be less than or equal to the value in the declaration
section.
type indicates the type of nodes in the zone. TGrid uses this value to indicate the
following types: zero for virtual nodes, one for no (any) type, and two for boundary
nodes. TGrid ignores nodes of type zero and read all others, but these codes write only
type one.
ND is an optional argument that indicates the dimensionality of the node data, where ND
is 2 or 3.
If the number of dimensions in the grid is two, as specified by the Dimensions section
described above or in the node header, then only x and y coordinates are present on each
line.
c Fluent Inc. January 7, 2004 B-3
Mesh File Format
Because the grid connectivity is composed of integers representing pointers (see Cells and
Faces, below), using hexadecimal conserves space in the file and provides for faster file
input and output. The header indices are also in hexadecimal so that they match the
indices in the bodies of the grid connectivity sections. The zone-id and type are also
in hexadecimal for consistency.
This section indicates the pairings of periodic faces on periodic boundaries. Grids without
periodic boundaries do not have sections of this type. The format of the section is as
follows:
where first-index is the index of the first periodic face pair in the list, last-index is
the last one, periodic-zone is the zone ID of the periodic face zone, and shadow-zone
is the zone ID of the corresponding shadow face zone. These are in hexadecimal format.
B-4
c Fluent Inc. January 7, 2004
B.6 Cells
The indices in the section body (f*) refer to the faces on each of the periodic boundaries
(in hexadecimal), the indices being offsets into the list of faces for the grid. Note that
first-index and last-index do not refer to face indices; they refer to indices in the
list of periodic pairs.
A partial example of such a section follows.
(18 (1 2b a c) (
12 1f
13 21
ad 1c2
.
.
.
))
B.6 Cells
Index: 12
Scheme symbol: xf-cell
C macro: XF CELL
Codes: FLUENT, TGrid
Status: required
Again, zone-id is zero to indicate that it is a declaration of the total number of cells.
If last-index is zero, then there are no cells in the grid. This is useful when the file
contains only a surface mesh to alert the solvers that it cannot be used.
The type is ignored in a declaration section and is usually given as zero, while the
element-type is ignored completely.
For example,
states that there are 3e3 (hexadecimal) = 995 cells in the grid. This declaration section
is required and must precede the regular cell sections.
c Fluent Inc. January 7, 2004 B-5
Mesh File Format
The element-type in a regular cell section header indicates the type of cells in the
section, as follows:
Regular cell sections have no body, but they have a header of the same format where
first-index and last-index indicate the range for the particular zone, type indicates
whether the cell zone is an active zone (solid or fluid), or inactive zone (currently only
parent cells resulting from hanging node adaption). Active zones are represented with
type=1, while inactive zones are represented with type=32.
A type of zero indicates a dead zone and will be skipped by TGrid. If a zone is of mixed
type (element-type=0), it will have a body that lists the element type of each cell.
For example,
(12 (9 1 3d 0 0)(
1 1 1 3 3 1 1 3 1
.
.
.
))
states that there are 3d (hexadecimal) = 61 cells in cell zone 9, of which the first 3 are
triangles, the next 2 are quadrilaterals, and so on.
The cell section is not required for TGrid when the file contains only a surface mesh.
B.7 Faces
Index: 13
Scheme symbol: xf-face
C macro: XF FACE
Codes: FLUENT, TGrid
Status: required
The face section has a header with the same format as that for cells (but with a section
index of 13).
B-6
c Fluent Inc. January 7, 2004
B.7 Faces
Again, a zone-id of zero indicates a declaration section with no body, and element-type
indicates the type of faces in that zone.
The body of a regular face section contains the grid connectivity, and each line appears
as follows:
n0 n1 n2 cr cl
where n* are the defining nodes (vertices) of the face, and c* are the adjacent cells.
This is an example of the triangular face format; the actual number of nodes depends
on the element type. The ordering of the cell indices is important. The first cell, cr, is
the cell on the right side of the face and cl is the cell on the left side.
Handedness is determined by the right-hand rule: if you curl the fingers of your right
hand in the order of the nodes, your thumb will point to the right side of the face. In 2D
grids, the k vector pointing outside the grid plane is used to determine the right-hand-side
cell (cr) from k r.
If there is no adjacent cell, then either cr or cl is zero. All cells, faces, and nodes have
positive indices. For files containing only a boundary mesh, both these values are zero.
If it is a two-dimensional grid, n2 is omitted.
If the face zone is of mixed type (element-type = 0), the body of the section will include
the face type and will appear as follows:
type v0 v1 v2 c0 c1
c Fluent Inc. January 7, 2004 B-7
Mesh File Format
The current valid boundary conditions types are defined in the following table:
bc name bc id
interior 2
wall 3
pressure-inlet, inlet-vent, intake-fan 4
pressure-outlet, exhaust-fan, outlet-vent 5
symmetry 7
periodic-shadow 8
pressure-far-field 9
velocity-inlet 10
periodic 12
fan, porous-jump, radiator 14
mass-flow-inlet 20
interface 24
parent (hanging node) 31
outflow 36
axis 37
For non-conformal grid interfaces, the faces resulting from the intersection of the non-
conformal grids are placed in a separate face zone. A factor of 1000 is added to the type
of these sections, e.g., 1003 is a wall zone.
This section indicates the face hierarchy of the grid containing hanging nodes. The format
of the section is as follows:
B-8
c Fluent Inc. January 7, 2004
B.9 Cell Tree
where face-id0 is the index of the first parent face in section, face-id1 is the index
of the last parent face in section, parent-zone-id is the ID of the zone containing
the parent faces, child-zone-id is the ID of the zone containing the children faces,
number-of-kids is the number of children of the parent face, and kid-id-n are the face
IDs of the children.
These are in hexadecimal format. TGrid can read files that contain this section.
This section indicates the cell hierarchy of the grid containing hanging nodes. The format
of the section is as follows:
where cell-id0 is the index of the first parent cell in section, cell-id1 is the index of
the last parent cell in section, parent-zone-id is the ID of the zone containing the parent
cells, child-zone-id is the ID of the zone containing the children cells, number-of-kids
is the number of children of the parent cell, and kid-id-n are the cell IDs of the children.
These are in hexadecimal format. TGrid cannot read files that contain this section.
c Fluent Inc. January 7, 2004 B-9
Mesh File Format
This section indicates the relationship between the intersection faces and original faces.
The intersection faces (children) are produced from intersecting two non-conformal sur-
faces (parents) and are some fraction of the original face. Each child will refer to at least
one parent.
The format of the section is as follows:
where face-id0 is the index of the first child face in the section, face-id1 is the index
of the last child face in the section, parent-id-0 is the index of the right-side parent
face, and parent-id-1 is the index of the left-side parent face. These are in hexadecimal
format.
If you read a non-conformal grid from the solver into TGrid, TGrid will skip this section, so
it will not maintain all the information necessary to preserve the non-conformal interface.
When you read the grid back into the solver, you will need to recreate the interface.
Example Files
Example 1
c1 f1 c2 f2 c3 bf10
bf9
B-10
c Fluent Inc. January 7, 2004
B.10 Interface Face Parents
(0 "Grid:")
(0 "Dimensions:")
(2 2)
(12 (0 1 3 0))
(13 (0 1 a 0))
(10 (0 1 8 0 2))
(12 (7 1 3 1 3))
(13 (2 1 2 2 2)(
1 2 1 2
3 4 2 3))
(13 (3 3 5 3 2)(
5 1 1 0
1 3 2 0
3 6 3 0))
(13 (4 6 8 3 2)(
7 4 3 0
4 2 2 0
2 8 1 0))
(13 (5 9 9 a 2)(
8 5 1 0))
(13 (6 a a 24 2)(
6 7 3 0))
(10 (1 1 8 1 2)
(
1.00000000e+00 0.00000000e+00
1.00000000e+00 1.00000000e+00
2.00000000e+00 0.00000000e+00
2.00000000e+00 1.00000000e+00
0.00000000e+00 0.00000000e+00
3.00000000e+00 0.00000000e+00
3.00000000e+00 1.00000000e+00
0.00000000e+00 1.00000000e+00))
c Fluent Inc. January 7, 2004 B-11
Mesh File Format
Example 2
Figure B.10.2 illustrates a simple quadrilateral mesh with periodic boundaries but no
hanging nodes. In this example, bf9 and bf10 are faces on the periodic zones.
(0 "Dimensions:")
(2 2)
(0 "Grid:")
(12 (0 1 3 0))
(13 (0 1 a 0))
(10 (0 1 8 0 2))
(12 (7 1 3 1 3))
(13 (2 1 2 2 2)(
1 2 1 2
3 4 2 3))
(13 (3 3 5 3 2)(
5 1 1 0
1 3 2 0
3 6 3 0))
(13 (4 6 8 3 2)(
7 4 3 0
4 2 2 0
2 8 1 0))
B-12
c Fluent Inc. January 7, 2004
B.10 Interface Face Parents
(13 (5 9 9 c 2)(
8 5 1 0))
(13 (1 a a 8 2)(
6 7 3 0))
(18 (1 1 5 1)(
9 a))
(10 (1 1 8 1 2)(
1.00000000e+00 0.00000000e+00
1.00000000e+00 1.00000000e+00
2.00000000e+00 0.00000000e+00
2.00000000e+00 1.00000000e+00
0.00000000e+00 0.00000000e+00
3.00000000e+00 0.00000000e+00
3.00000000e+00 1.00000000e+00
0.00000000e+00 1.00000000e+00))
Example 3
f6 c6 f1 c3 bf17
c1 f5 c2 n5 f4 f2 bn3
bf16
n1
f7 c5 f3 c4 bf18
(0 "Grid:")
(0 "Dimensions:")
(2 2)
c Fluent Inc. January 7, 2004 B-13
Mesh File Format
(12 (0 1 7 0))
(13 (0 1 16 0))
(10 (0 1 d 0 2))
(12 (7 1 6 1 3))
(12 (1 7 7 20 3))
(58 (7 7 1 7)(
4 6 5 4 3))
(13 (2 1 7 2 2)(
1 2 6 3
1 3 3 4
1 4 4 5
1 5 5 6
6 7 1 2
5 8 2 6
9 5 2 5))
(13 (3 8 b 3 2)(
a 6 1 0
6 9 2 0
4 b 4 0
9 4 5 0))
(13 (4 c f 3 2)(
2 8 6 0
c 2 3 0
8 7 2 0
7 d 1 0))
(13 (5 10 10 a 2)(
d a 1 0))
(13 (6 11 12 24 2)(
3 c 3 0
b 3 4 0))
(13 (b 13 13 1f 2)(
c 8 7 0))
(13 (a 14 14 1f 2)(
B-14
c Fluent Inc. January 7, 2004
B.10 Interface Face Parents
b c 7 0))
(13 (9 15 15 1f 2)(
9 b 7 0))
(13 (8 16 16 1f 2)(
9 8 2 7))
(10 (1 1 d 1 2)
(
2.50000000e+00 5.00000000e-01
2.50000000e+00 1.00000000e+00
3.00000000e+00 5.00000000e-01
2.50000000e+00 0.00000000e+00
2.00000000e+00 5.00000000e-01
1.00000000e+00 0.00000000e+00
1.00000000e+00 1.00000000e+00
2.00000000e+00 1.00000000e+00
2.00000000e+00 0.00000000e+00
0.00000000e+00 0.00000000e+00
3.00000000e+00 0.00000000e+00
3.00000000e+00 1.00000000e+00
0.00000000e+00 1.00000000e+00))
c Fluent Inc. January 7, 2004 B-15
Mesh File Format
B-16
c Fluent Inc. January 7, 2004