msh file format
Client wants basic format for creating msh file. He wants to write filter for Ensight to Fluent directly.
CREATING A FLUENT MESH BY HAND
These notes are not official documentation, and technically the msh file
format is NOT formally supported. However this document should serve in providing
instructions for how to create a very basic mesh for fluent.
More complex data structures will require further research.
The format for data are SCHEME lists. These are ()-delimited data, or
multiply-nested ()-delimited data.
First of all lets start out with COMMENTS. These are ignored by the mesh
reader. The following is an example comment:
(0 "This is a comment")
where the comment is indicated by the "0" as the first datum after the opening
The order of the process is basically as follows
1. Read in grid dimension
2. Read nodes (corners of control volumes) in arbitrary order
3. Define face threads as sets of connections of the nodes. Each face will
indicate a c0 and c1 cell. All internal faces have a c0 and c1, boundary
faces only have a c0 (and c1 = 0).
4. Define cell thread
5. Name and assign types of face and cell threads
If 3D, the FIRST non-comment line in your .msh file will be
otherwise, if your mesh is 2D, you'll have
The format for reading nodes is the following
(10 (0 first_HEX last_HEX 1 3))
(10 (1 first_HEX last_HEX 1 3)(
x1 y1 z1
x2 y2 z2
. . .
xlast ylast zlast
If 2D, there will be no z-entries.
first_HEX = 1
last_HEX = number of nodes (in hexadecimal)
The order is unimportant, but below, when you construct the faces, you'll refer
to the node numbers.
3. FACE THREADS
The next line will be total number of faces:
(13(0 first_face_HEX last_face_HEX 0))
This is followed by the face thread info for EACH face thread:
(13 (id f1 f2 type 0) (
N n1 n2 n3 n4 c0 c1
. . . . . . .
. . . . . . .
id = face thread id
f1 = first face index in thread id
f2 = last face index in thread id
type = 2 - interior
3 - wall
4 - pressure inlet
5 - pressure outlet
7 - symmetry
8 - shadow (not sure how this is used... must do further research!)
9 - pressure far field
a - velocity-inlet
c - periodic
e - porous jump
14 - mass-flow inlet
N = number of nodes in face (3 for tri, 4 for quad)
n1, n2, n3, n4 = circuit of nodes that define face as defined by the right-hand rule
RHRule points to C0 cell. Boundary cells are defined such
than the rhrule points inward.
c0 = index of cell pointed to by the rhrule of the face. c0 never = 0
c1 = index of c1 cell (opposite c0). c1 = 0 on boundaries.
4. CELL THREADS
The next line will indicate the total number of cells
(12 (0 first_cell_HEX last_cell_HEX 0))
Then, we read in the cell zones
(12 (id c1 c2 1 type))
id = cell thread id
c1 = hex index of first cell in id
c2 = hex index of last cell in id
type = 4 for hex
type = 2 for tet
type = 5 for pyramid
Or.. we can specify a mixed cell zone as follows
(12 (id c1 c2 1 0) (
t1 t2 t3 ... t_lastcell
where t# is the type of that cell
5. ZONE ASSIGNMENT
For each cell and face zone you will have the line
(45 (id type name)())
type = wall, solid, interior, etc
name = name of the boundary that'll appear in GUI