FreeCAD makes it easy to create a mesh on a single body or surface. However if we want one body or surface that is a combination of multiple solids or surfaces that share the same boundaries isn’t so direct. This is fundamental when creating more detailed meshes for example. In this article I will be exploring how we go about creating this in FreeCAD, slicing and joining surfaces to finally export the final geometry to create a differentiated mesh in Gmsh.
- SOFTWARE USED
- CREATING GEOMETRY
- SPLITING AND CONNECTING
- EXPORTING AND MULTIZONE
- FINAL COMMENTS
1. SOFTWARE USED
For this article two main softwares were used. FreeCAD and Gmsh. However I suspect that under the hood we use OPENCASCADE for the geometry importing and exporting.
2. CREATING GEOMETRY
The first think to do is to create a 2D sketch (sketcher workbench) with the geometry you wish to study.
After creating this geometry you need to create a surface from the sketch. This for me was a bit tricky. I went to the Surface workbench and selected the “Create surface from …” icon.

Surface icon in FreeCAD
After clicking a new menu appears on the left and you have to select the lines bounding the surface. This did not run that smoothly but I managed to select all bounding surfaces.
If successful when hovering the geometry you will get a green highlight surface. After this is successful you need to create the splitting lines in a new sketch. I placed this sketch in the same part of the main geometry.
The resulting imagine can be seen bellow.
Now we are ready to split the surface of the 2D geometry we created. To do this we will need the Part Workbench. We will need to slice the target surface according to the lines we built on the second sketch. You first select the target surface and the select the reference cutting geometry. Then click Slice apart.

Slice object according to references in FreeCAD
You should now get 4 independent areas. and at the left in the tree view a exploded slice folder with the four surfaces.
After having a sliced geometry we need to connect everything together. For this in the Part Workbench we need to select Connect objects.
Congratulations. We now have the geometry prepared for simulation. I think that up to here you can use a instead of a planar 2D surface you could use actually any geometry from line, 3D surface or a solid body.
3. SPLITING AND CONNECTING
In another post I have explained how to export this geometry to Gmsh and receive it back to use in the internal FEM workbench workflow. The link bellow will guide you to achieve this purpose. Follow it, for it is very easy.
http://using-freecad-fem-workbench-with-external-gmsh-mesh
In Gmsh to create a mesh with different meshing attributes in each segmented area is the focus next.
A normal mesh will create a more homogeneous line divisions as can be seen bellow.
In this surface I decided to use a Hex mesh with the following configuration:

Gmsh Hex mesh config
To mesh independently one specific line we need to go to the tree view, select Mesh -> Define -> Transfinite -> Curve.

Gmsh Tranfinite options
In this spot I had a lot of troubles. I could not select the lines. To solve this you need to
To select the lines you need to click no the red box with an S. If you are successful the red box will change colour and you now can select the lines you want to change. In the menu box is the value you can influence the number of segments on the defined line. The image above show different number of divisions on the left and right diagonals.
From here you follow the same flow from my previous post:
http://using-freecad-fem-workbench-with-external-gmsh-mesh
From here if you have imported correctly the unv file you should now be able to add it to you FEM project.

Imported mesh in FEM project in FreeCAD

Boundary connections with new mesh in FreeCAD
And calculation runs without any problems.

Calculix result with no errors in FreeCAD
4. FINAL COMMENTS
Everything ran smoothly from slicing, connecting, transferring from FreeCAD to Gmsh and back and finally integrating the import with the base simulation.
You must be logged in to post a comment.