FiniteMesh.jl

Mesh I/O and connectivity computation methods
Author vavrines
Popularity
20 Stars
Updated Last
4 Months Ago
Started In
April 2021

FiniteMesh.jl

version CI codecov deps

This package provides lightweight methods for mesh I/O. The input interface is based on the Python project meshio. The supported formats include:

Abaqus (.inp), ANSYS msh (.msh), AVS-UCD (.avs), CGNS (.cgns), DOLFIN XML (.xml), Exodus (.e, .exo), FLAC3D (.f3grid), H5M (.h5m), Kratos/MDPA (.mdpa), Medit (.mesh, .meshb), MED/Salome (.med), Nastran (bulk data, .bdf, .fem, .nas), Neuroglancer precomputed format, Gmsh (format versions 2.2, 4.0, and 4.1, .msh), OBJ (.obj), OFF (.off), PERMAS (.post, .post.gz, .dato, .dato.gz), PLY (.ply), STL (.stl), Tecplot(.dat), TetGen(.node/.ele), SVG (2D output only) (.svg), SU2 (.su2), UGRID (.ugrid), VTK (.vtk), VTU (.vtu), WKT (TIN) (.wkt), XDMF (.xdmf, .xmf).

Installation

FiniteMesh.jl is a registered package in the official Julia package registry. We recommend installing it with the built-in Julia package manager. From the Julia REPL, you can get into the package manager (by pressing ]) and add the package. This will automatically install the package and all its dependencies.

julia> ]
(v1.10) pkg> add FiniteMesh

Usage

To read a mesh, simply do

using FiniteMesh
cells, points = read_mesh("path-of-mesh-file")

The resulting points are the coordinates of nodes, and cells provides the affiliation information of these points to cell IDs.

The connectivity calculator is provided with native Julia. The following information can be inferred from cells and points:

  • Node IDs of a face
  • Adjacent cell IDs of a face
  • Neighbor cell IDs of a cell
  • Cell type (inner / boundary)
  • Cell volume
  • Face area
  • Cell center location
  • Face center location
  • Unit normal vector of a face

For convenience, a Mesh struct is defined to contain all the above information as its fields. It can be constructed simply via

mesh = Mesh("path-of-mesh-file")