cape.msh: FLUENT mesh module

It provides a class Msh whose primary goal is to read a FLUENT mesh and write an AFLR3 UGRID mesh.

The class provided in this module, cape.msh.Msh, is only partially implemented, so extensive usage may run into limitations.

class cape.msh.Msh(fname)

Interface for FUN3D meshes based on Fluent(R) file format

Cell types:

Faces:

In M.FaceCells, the normal of M.Face[k] points into cell M.FaceCells[k,0] and out of cell M.FaceCells[k,1]

GetBoundaryZoneIDs()

Select the zone IDs that match a list of names

Call:
>>> K = M.GetZoneIDsByType(typs)
Inputs:
M: cape.msh.Msh

Volume mesh interface

typs: list[str]

List of types

Outputs:
K: list[int]

List of zone IDs

Versions:
  • 2015-10-23 @ddalle: Placeholder

GetCells()

Get the volume cells from the face connectivity

The results are saved to the following np.ndarray arrays of ints.

  • M.Cells: (M.nCell, 8)

  • M.Tets: (M.nTet, 4)

  • M.Pyrs: (M.nPyr, 5)

  • M.Prisms: (M.nPrism, 6)

  • M.Hexes: (M.nHex, 8)

Call:
>>> M.GetCells()
Inputs:
M: cape.msh.Msh

Volume mesh interface

Versions:
  • 2015-10-22 @ddalle: Version 1.0

GetFluentLineType(line)

Get the line type and whether or not the line ends

Entity types are tabulated below.

  • 0: comment

  • 2: dimensional specification

  • 10: nodes

  • 12: cells (volumes)

  • 13: faces

  • 39: zone labels

Call:
>>> typ, vals, q = M.GetFluentLineType(line)
Inputs:
M: cape.msh.Msh

Volume mesh interface

line: str

Text from a Fluent line

Outputs:
typ: int

Entity type

vals: str | list (int)

List of specification indices or text if a comment

q: bool

Whether a line ends with ‘)’ and is therefore closed

Versions:
  • 2015-10-22 @ddalle: Version 1.0

GetHexes()

Get the hexahedron volume cells from the face connectivity

The results are saved to M.Hexes as np.ndarray ((M.nHex, 8), int)

Call:
>>> M.GetHexe()
Inputs:
M: cape.msh.Msh

Volume mesh interface

Versions:
  • 2015-10-23 @ddalle: Placeholder

GetPrisms()

Get the prism volume cells from the face connectivity

The results are saved to M.Prisms as np.ndarray ((M.nPrism, 6), int)

Call:
>>> M.GetPrisms()
Inputs:
M: cape.msh.Msh

Volume mesh interface

Versions:
  • 2015-10-23 @ddalle: Version 1.0

GetPyrs()

Get the pyramid volume cells from the face connectivity

The results are saved to M.Pyrs as np.ndarray ((M.nPyr, 5), int)

Call:
>>> M.GetPyrs()
Inputs:
M: cape.msh.Msh

Volume mesh interface

Versions:
  • 2015-10-23 @ddalle: Placeholder

GetTets()

Get the tetrahedron volume cells from the face connectivity

The results are saved to M.Tets as np.ndarray ((M.nTet, 4), int)

Call:
>>> M.GetTets()
Inputs:
M: cape.msh.Msh

Volume mesh interface

Versions:
  • 2015-10-23 @ddalle: Version 1.0

GetZoneIDsByType(typs)

Select the zone IDs that match a list of names

Call:
>>> K = M.GetZoneIDsByType(typs)
Inputs:
M: cape.msh.Msh

Volume mesh interface

typs: list[str]

List of types

Outputs:
K: list[int]

List of zone IDs

Versions:
  • 2015-10-23 @ddalle: Placeholder

ProcessPrismsQuad(f, j)

Process the prism cell information of one quad

Call:
>>> M.ProcessPrismsQuad(f, j)
Inputs:
M: cape.msh.Msh

Volume mesh interface

f: np.ndarray[int] shape: 4,

List of vertex indices in a face (should be a tri)

j: int

Index of neighboring cell

Versions:
  • 2015-10-23 @ddalle: Version 1.0

ProcessPrismsTri(f, j, L)

Process the prism cell information of one tri

Call:
>>> M.ProcessPrismsTri(f, j, L)
Inputs:
M: cape.msh.Msh

Volume mesh interface

f: np.ndarray[int] shape: 4,

List of vertex indices in a face (should be a tri)

j: int

Index of neighboring cell

L: int

Index for left (1) or right (0)

Versions:
  • 2015-10-22 @ddalle: Version 1.0

ProcessPyrsQuad(f, j, L)

Process the pyramid cell information of one quad

Call:
>>> M.ProcessPyrsQuad(f, j, L)
Inputs:
M: cape.msh.Msh

Volume mesh interface

f: np.ndarray[int] shape: 4,

List of vertex indices in a face (should be a quad)

j: int

Index of neighboring cell

L: int

Index for left (1) or right (0)

Versions:
  • 2015-11-17 @ddalle: Version 1.0

ProcessPyrsTri(f, j, L)

Process the pyramid cell information of one tri

Call:
>>> M.ProcessPyrsTri(f, j, L)
Inputs:
M: cape.msh.Msh

Volume mesh interface

f: np.ndarray[int] shape: 4,

List of vertex indices in a face (should be a quad)

j: int

Index of neighboring cell

L: int

Index for left (1) or right (0)

Versions:
  • 2015-11-17 @ddalle: Version 1.0

ProcessTetsTri(f, j, L)

Process the tetrahedron cell information of one tri

Call:
>>> M.ProcessTetsTri(f, j, L)
Inputs:
M: cape.msh.Msh

Volume mesh interface

f: np.ndarray[int] shape: 4,

List of vertex indices in a face (should be a tri)

j: int

Index of neighboring cell

L: int

Index for left (1) or right (0)

Versions:
  • 2015-10-23 @ddalle: Version 1.0

ReadFluentASCII(fname)

Read ASCII Fluent(R) mesh file

Call:
>>> M.ReadFluentASCII(fname)
Inputs:
M: cape.msh.Msh

Volume mesh interface

fname: str

Name of .msh file to read

Versions:
  • 2015-10-22 @ddalle: Version 1.0

ReadFluentMixedFacesASCII(f, k, i0, i1)

Read a block of mixed-type faces from ASCII Fluent mesh file

Call:
>>> M.ReadFluentQuadsASCII(f, k, i0, i1)
Inputs:
M: cape.msh.Msh

Volume mesh interface

f: file

File handle in correct location

k: int

Component ID for these faces

i0: int

Index (1-based) of first node to read

i1: int

Index (1-based) of last node to read

Versions:
  • 2015-10-22 @ddalle: Version 1.0

ReadFluentNodesASCII(f, i0, i1)

Read nodes from an ASCII Fluent mesh file

Call:
>>> M.ReadFluentNodesASCII(f, i0, i1)
Inputs:
M: cape.msh.Msh

Volume mesh interface

f: file

File handle in correct location

i0: int

Index (1-based) of first node to read

i1: int

Index (1-based) of last node to read

Versions:
  • 2015-10-22 @ddalle: Version 1.0

ReadFluentQuadsASCII(f, k, i0, i1)

Read a block of quad faces from an ASCII Fluent mesh file

Call:
>>> M.ReadFluentQuadsASCII(f, k, i0, i1)
Inputs:
M: cape.msh.Msh

Volume mesh interface

f: file

File handle in correct location

k: int

Component ID for these faces

i0: int

Index (1-based) of first node to read

i1: int

Index (1-based) of last node to read

Versions:
  • 2015-10-22 @ddalle: Version 1.0

ReadFluentTrisASCII(f, k, i0, i1)

Read a block of tri faces from an ASCII Fluent mesh file

Call:
>>> M.ReadFluentTrisASCII(f, k, i0, i1)
Inputs:
M: cape.msh.Msh

Volume mesh interface

f: file

File handle in correct location

k: int

Component ID for these faces

i0: int

Index (1-based) of first node to read

i1: int

Index (1-based) of last node to read

Versions:
  • 2015-10-22 @ddalle: Version 1.0

WriteAFLR3ASCII(fname)

Write AFLR3 mesh file

Call:
>>> M.WriteAFLR3ASCII(fname)
Inputs:
M: cape.msh.Msh

Volume mesh interface

fname: str

Name of .ugrid file to write

Versions:
  • 2015-10-23 @ddalle: Version 1.0