FEM MeshGmshFromShape

Description
For a finite elements analysis the geometry needs to be discretized into a FEM Mesh. This command uses the program Gmsh (which needs to be installed on the system) for calculating the mesh.

Depending on your operating system and your installation package Gmsh might be installed or not. For further information see FEM_Install.

Usage

 * 1) Select the shape you want to analyze. For volume FEM this needs to be a solid or compsolid. A compsolid is necessary if your part is made from multiple materials. (A compsolid can be created with the BooleanFragments command.)
 * 2) * Press the button.
 * 3) * Select the option from the menu.
 * 4) Optionally edit the minimal and maximal element size. (Autodetection works fine unless you apply complicated boundary conditions.)
 * 5) Click the  button and wait for the computation of the mesh to complete
 * 6) Close the task. You now should see a new FEMMeshGMSH object in your active analysis container.

After the mesh has been crated you can change its properties using the property editor. After you changed a property, you must reopen the Gmsh dialog again and click the button. (You can leave the dialog open while changing properties.)

Properties

 * : The algorithm to create 2D meshes. The different algorithms are explained here. For Delaunay, see Delaunay triangulation.
 * : The algorithm to create 3D meshes. The different algorithms are explained here.
 * : The maximal size of the mesh elements. If set to 0.0, the size will be set automatically. This property can also be changed in the Gmsh dialog in the field Max element size.
 * : The minimal size of the mesh elements. If set to 0.0, the size will be set automatically. This property can also be changed in the Gmsh dialog in the field Min element size.
 * true (default); duplicate mesh nodes will be removed
 * false
 * : The dimension of the mesh elements. This property can also be changed in the Gmsh dialog in the field Mesh element dimension.
 * From Shape (default); the dimension will be determined from the dimension of the object that is meshed
 * 1D
 * 2D
 * 3D
 * : The mesh element order. This property can also be changed in the Gmsh dialog in the field Mesh order.
 * 1st
 * 2nd (default)
 * : The geometrical tolerance for the mesh to match the object edges. The default 0.0 means that Gmsh's default of 1e-8 is used.
 * : All nodes and not only the elements will be saved for each physical mesh group. Physical groups are collections of mesh entities (points, curves, surfaces and volumes). They and are identified by their dimension and by a tag. For example a mesh of the same object region is internally tagged the same. So all surfaces of this region will form one physical group.
 * : If and how meshes with = 2nd are optimized. The optimization is done by a deformation of the element borders.  Gmsh supports different optimization algorithms. Elastic is an algorithm in which the mesh elements are treated as a collection of deformable viscoelastic solids. 1st order meshes cannot be optimized because their element borders are linear an cannot be deformed.
 * : The number of mesh elements per $$2\pi$$ times the radius of the curvature. To get a finer mesh at small corners or holes, this value can be increased for better results
 * : The number of mesh elements per $$2\pi$$ times the radius of the curvature. To get a finer mesh at small corners or holes, this value can be increased for better results


 * : Whether the mesh will be optimized using the 3D mesh generator Netgen to improve the quality of tetrahedral elements. Note: since Netgen can only create tetrahedral elements, this option is ignored for meshes whose  is not 3D.
 * : The algorithm used for and also for . For more info, see section Element Recombination and for technical details see the Gmsh documentation.
 * : Applies a recombination 3D-algorithm to all volumes. Tetrahedra will be recombined into prisms, hexahedra or pyramids if possible.
 * : Applies a recombination algorithm to all surfaces. Triangles will be recombined into quadrangles when possible.
 * Optimizes the mesh to improve the quality of tetrahedral elements.
 * : Option if second order nodes (if set to 2nd) and/or mesh refinement points are created by linear interpolation.
 * true; linear interpolation is used
 * false (default); curvilinear interpolation is used

Nonpositive Jacobians
When you get a meshing erro about nonpositive Jacobians, you can try out the following strategies:


 * Set to true but keep  at 2nd.
 * Set to 1st.
 * Use a smaller element size by reducing the.
 * If solver ccxtools is used and the run button is used (not the task panel) the nodes of non positive jacobian elements will be green.

Mesh Growth
At edges and small geometric entities the mesh has to be smaller than in areas without edges. So the mesh element size grows away from edges. The growing strategy of Gmsh is to grow between edges with different sizes. So the growing fails when an area has the same sized edges like for example this tube:



To enable a sensible mesh growing, you must in this case add an edge to the area. In the example this would be a circle in the middle of the cylinder. The circle is added as part of a BooleanFragments compound (to form a CompSolid), see the project file of the example.



Element Recombination
Elements can be recombined in two ways, on the surface of objects so that triangles will be recombined into quadrangles if possible and in the volume of objects so that tetrahedra will be recombined into prisms, hexahedra or pyramids if possible. Thinking about the geometry, it becomes clear that the recombination result depends strongly on the geometry of the body and that recombining a 3D body only at the surface will mostly lead to strange results.

To illustrate this, look at the image below. A cuboid body is meshed using the standard settings (tetrahedra, 2nd order mesh). This is the subimage at the upper left. The image at the upper right shows the result, when additionally the elements are recombined only at the surface of the body. The result is bad because the changed surface elements don't fit to the unchanged volume elements. So alone usually only makes sense for 2D meshes. When we use now also, the result is better, see the lower left subimage. However, the result doesn't show a great difference compared to the mesh without recombinations. Since our body is a cuboid, it is therefore sensible to use a recombination algorithm that tries to create cuboids as well. And this result is shown in the subimage at the lower right.

The Simple recombination algorithm will leave some triangles in the mesh in case the recombining leads to badly shaped quads. In such cases use a full-quad recombination algorithm, which will automatically perform a coarser mesh followed by the recombination, smoothing and subdividing. See forum topic