How to Refine Mesh Density in FreeCAD FEM
Refining the mesh density around high-stress concentrations—such as holes, fillets, notches, and sharp corners—is essential for obtaining accurate stress results in FreeCAD's Finite Element Method (FEM) workbench without unnecessarily increasing computational time. This guide explains how to use local mesh refinement tools, primarily through the Gmsh mesher and the "FEM Mesh Region" feature, to target critical areas and achieve precise convergence in your stress analysis.
Step 1: Set Up the Base FEM Mesh with Gmsh
While FreeCAD supports both Netgen and Gmsh, Gmsh offers the most reliable and flexible control over local mesh sizing.
- Switch to the FEM Workbench.
- Select your 3D solid model in the tree view.
- Click the FEM mesh from shape by Gmsh button in the toolbar.
- Set an appropriate Max element size for the overall part to keep the baseline node count reasonable.
- Click Apply to generate the initial global mesh.
Step 2: Create a Local Mesh Refinement Object
To refine specific areas, use the FEM Mesh Region tool.
- In the tree view, select the Gmsh mesh object you just created.
- Click the FEM mesh region icon (or go to
Mesh > FEM mesh region). - In the Task panel, you will see a field for Characteristic length (element size). Enter a value significantly smaller than the global mesh size (e.g., half to one-quarter of the global size, depending on the severity of the stress gradient).
Step 3: Assign Geometry to the Refinement Region
- With the Mesh Region Task panel still open, click the Add button.
- In the 3D viewport, select the specific geometric elements located
in the high-stress zone:
- Faces: Ideal for internal cylindrical surfaces of holes or the curved surfaces of fillets.
- Edges: Ideal for sharp transitions or perimeter areas where stress peaks.
- Vertices: Useful for localized point-load applications or extreme corners.
- Click OK to confirm the selection and close the panel.
Step 4: Re-evaluate and Regenerate the Mesh
- Double-click the parent Gmsh object in the tree view to reopen its settings.
- Click Apply to re-run the meshing algorithm.
- FreeCAD and Gmsh will regenerate the mesh, creating a smooth size transition from the fine elements around the selected features to the coarser elements in the bulk of the component.
- Inspect the mesh visually in the viewport to ensure the transition is gradual and that no distorted (high aspect ratio) elements are present.
Step 5: Verify Mesh Quality and Convergence
- Run your FEM solver (CalculiX) with the refined mesh.
- Check the equivalent von Mises stress distribution around the refined zones.
- Perform a mesh convergence study: Reduce the element size in the Mesh Region tool by an additional 25–50% and re-solve. If the peak stress value changes by less than 2–5%, your mesh density is sufficiently refined for engineering accuracy.