Check FEM Mesh Quality and Aspect Ratio in FreeCAD
Evaluating mesh quality metrics like aspect ratio, skewness, and Jacobian ratios is critical for obtaining accurate finite element analysis (FEA) results. This article provides a direct guide on how to inspect these metrics in FreeCAD's FEM Workbench using built-in meshing tools like Gmsh, the Report View console, and the Mesh Workbench conversion workflow.
Method 1: Inspect Metrics via Gmsh in the FEM Workbench
Gmsh is the primary mesher in FreeCAD that calculates comprehensive 2D and 3D element quality metrics, including aspect ratio and element distortion.
- Open the FEM Workbench and create or double-click your existing FEM mesh Gmsh object in the tree view.
- Ensure the Report View is visible in FreeCAD
(
View>Panels>Report view). - In the Gmsh task panel, set your desired element sizing parameters and click Apply to generate the mesh.
- Review the Report View panel at the bottom of the
screen. Gmsh outputs statistical summaries for the generated elements,
including:
- SICN (Signed Inverse Condition Number): Measures element distortion where 1.0 represents an ideal element.
- Gamma: A quality measure relating volume to edge length.
- Aspect Ratio: Minimum, maximum, and average values are logged for tetrahedral or hexahedral elements.
- If negative Jacobians or poor aspect ratios (values significantly exceeding recommended thresholds, typically > 10:1) are reported, decrease the maximum element size or apply local mesh refinement on edges and faces.
Method 2: Convert FEM Mesh to Standard Mesh for Topological Checks
To visually locate damaged or poorly shaped faces on the surface of the mesh:
- Select the FEM mesh in the model tree.
- Go to the menu and select
FEM>FEM mesh to Mesh(or use the toolbar icon). This creates a standard surface mesh object. - Switch from the FEM Workbench to the Mesh Workbench using the workbench dropdown.
- Select the newly created mesh object in the tree.
- Go to
Meshes>Analyze>Evaluate & Repair mesh.... - Click Analyze next to tests like Degenerated faces, Folds on surface, or Non-manifolds to highlight distorted surface triangles that result from poor aspect ratios in the underlying solid elements.
Method 3: Query Mesh Data via the Python Console
For programmatic access to aspect ratios and element dimensions, use FreeCAD's Python console:
Open the Python console (
View>Panels>Python console).Access the FEM mesh data with:
mesh_obj = App.ActiveDocument.ActiveObject # Ensure the FEM Mesh is selected fem_mesh = mesh_obj.FemMesh print(f"Nodes: {fem_mesh.NodeCount}") print(f"Volumes: {fem_mesh.VolumeCount}")Use the
fem_mesh.Volumescollection to iterate through element node coordinates and calculate exact aspect ratios for targeted elements.