Gmsh
Three-dimensional finite element mesh generator with a built-in CAD engine and post-processing facilities. Provides fast, reliable meshing for complex 2D and 3D geometries.
Supported Element Types
Line (1D)
Order: 1st–5th
Triangle
Order: 1st–5th
Quadrilateral
Order: 1st–2nd
Tetrahedron
Order: 1st–5th
Hexahedron
Order: 1st–2nd
Prism
Order: 1st–2nd
Pyramid
Order: 1st–2nd
Point (0D)
Order: —
Key Features
CAD Engine
Built-in constructive solid geometry (CSG) kernel for creating 2D and 3D models. Boolean operations (union, intersection, difference) on geometric primitives. Supports STEP, IGES, BREP, and STL import/export via OpenCASCADE.
Mesh Generation
Generate structured, unstructured, and hybrid meshes. Supports tetrahedra, hexahedra, prisms, pyramids, and arbitrary polyhedra. Algorithms include Delaunay triangulation, advancing front, and transfinite interpolation.
Mesh Quality & Adaptivity
Mesh quality optimisation with Laplacian smoothing and topological operations. Adaptive mesh refinement (h-refinement, p-refinement) based on error estimators. Anisotropic meshing for boundary layers.
Scripting & API
Full Python and C++ API for programmatic mesh generation. Gmsh scripting language (.geo files) for parametric model definitions. Integration with FEniCS, deal.II, and GetDP for solver coupling.
Mesh Quality Metrics
Gmsh evaluates element quality using shape metrics. For triangles, the standard metric is:
Where A is the triangle area and l_i are edge lengths. η = 1 for an equilateral triangle, η → 0 for degenerate elements.
Example: Geometry Script
// Rectangle with circular hole — Gmsh .geo script
SetFactory("OpenCASCADE");
// Define rectangle
Rectangle(1) = {0, 0, 0, 10, 5};
// Define circle (hole)
Disk(2) = {5, 2.5, 0, 1.0};
// Boolean subtraction
BooleanDifference(3) = { Surface{1}; Delete; }{ Surface{2}; Delete; };
// Set mesh size
MeshSize{ PointsOf{ Surface{3}; } } = 0.3;
// Generate 2D mesh
Mesh 2;Resources: Visit gmsh.info for official documentation. VELSTROM tutorials for meshing geospatial terrain models are under development.