FEM Mesh

Create a FE mesh
Finite element analysis is performed on a mesh composed of multiple triangular and quadrilateral finite elements.



There are different possibilities to set up a mesh in FreeCAD:
 * The Netgen tool (FEM MeshNetgenFromShape) from the graphical user interface or by Python scripting.
 * The Gmsh tool (FEM MeshGmshFromShape) from the graphical user interface of by Python scripting.
 * Importing a mesh from another program. In particular, Netgen and Gmsh can be used by themselves outside of FreeCAD to mesh solid bodies like Step files.
 * Manually creating the mesh through Python scripting.

The Netgen and Gmsh tools support meshing bodies created with the Part and PartDesign Workbenches, as well as simple copies of those solids. They are convenience tools to quickly mesh a body, and thus don't expose the full capabilities of these programs. If you'd like to have more control of the created mesh (only quadrilaterals, precise element number and size, etc.), you should use these programs externally, produce a mesh file, and import this file into FreeCAD.

Previously, Netgen was included with FreeCAD and could be used immediately. Now, both Netgen and Gmsh should be installed before they can be used by the FEM Workbench. Refer to FEM Install for instructions.

Meshing software
Meshing software operates on solid bodies that can be in different formats, like Step and Brep. These programs can be used independently of FreeCAD, and typically have many options to control the meshing algorithms, element size, and boundary conditions.

The FEM Workbench has developed simple communication interfaces to use Gmsh and Netgen directly inside FreeCAD. Other programs don't have an interface, but this could change in the future if there is interest from the community, and if those applications are easy to integrate. The meshing software can be compiled and distributed together with FreeCAD only if its license is compatible with the GPL2 or LGPL2 licenses; otherwise, the program has to be used as an external binary, like Gmsh is used.

Interface implemented in FreeCAD

 * Gmsh: main website, code repository
 * Netgen: main website, code repository

No interface

 * ENigMA, forum thread, code repository
 * libMesh, main website, code repository, forum thread; it's a very active project, and it's C++ only
 * PythonOCC, main website
 * SnappyHexMesh, main website
 * Tetgen, main website

Mesh elements in FreeCAD
FreeCAD supports various element types. The following article explains the difference between them, and when should be used: Meshing Your Geometry: When to Use the Various Element Types.


 * "NI" means the element type is not implemented in FreeCAD but the format would support it.
 * Edit_Cancel.svg "-" means the format specification does not support this element type, thus FreeCAD can not support it.
 * "?" means it is not known if the format supports this element type.

General
More information on the elements, and their data structure inside FreeCAD can be found in FEM Element Types.

Create a FEM mesh completely in Python
FreeCAD Scripting Basics.

The Python API allows the user to define a finite element mesh by directly adding individual nodes.

Creating a mesh with one Tet-10 Elements
Create an empty mesh object, populate it with nodes, add the volume, and show the mesh.

If you want to have predefined element and node numbering:

Visual handling
Highlight some nodes on the view:

Postprocessing colors and displacement.