I am currently trying to do a magnetostatic FEM simulation and I want to mesh my geometry using GMSH. The geometry is shown below: in
I create the geometry using FreeCAD and import into GMSH as a .STEP File. In GMSH I define 3 physical groups, resulting in the following script:
Merge "yoke_simulation.step";
Physical Volume("iron") = {1, 7, 9, 6, 3, 2, 4};
//+
Physical Volume("current") = {5};
//+
Physical Volume("air") = {8};
When I create the Mesh, I get the following result:
The problem is that GMSH seems to be creating a seperate mesh for each body without connecting these meshes with one another. If one looks at the region between the two cones for example, it is evident that the mesh of the two cones is not connected to the mesh of the air:
How can I get GMSH to create a single, connected mesh for all bodies?
It seems that right now the Air
volume 8
is just the overall bounding box, without necessary subtraction of volumes for Iron
and Current
. Thus, it creates a tetrahedral mesh for the entire bounding box without taking other bodies into the account.
I am not a FreeCAD expert, so I don't really know how to setup it properly there. Possibly, try specifying the Air
volume there making sure it does not contain your detail.
Another approach could involve slight modifications at the GMSH level. For example, creating the proper Air
volume before making it physical. You have volumes 1, 7, 9, 6, 3, 2, 4, 5
which you want to subtract from volume 8
. That can be achieved by
BooleanDifference(100) = { Volume{8}; Delete; }{ Volume{1,7,9,6,3,2,4,5}; };
Physical Volume("air") = {100};
Notice, that the previous code will work only if OpenCASCADE kernel inside GMSH is used. Please, see the following sample code in GMSH for reference:
SetFactory("OpenCASCADE");
Box(1) = {0,0,0, 1,1,1};
Box(2) = {0.1,0.1,0.1, 0.2,0.2,0.2};
Box(3) = {0.5,0.5,0.5, 0.2,0.2,0.2};
BooleanDifference(100) = { Volume{1}; Delete; }{ Volume{2,3}; };
Physical Volume ("air") = {100};
Physical Volume ("iron") = {2,3};