Generate finite element analysis(FEA) mesh from STL files

With the development of computer graphics, hardware, and 3D printing technology, graphic rendering and its file format based on surface triangle mesh have become more and more popular. In finite element analysis (FEA), engineers sometimes get geometry files based on triangle meshes (such as STL files, etc.) and perform subsequent analysis. Due to the fundamental difference between the surface triangle mesh and the finite element mesh, the surface mesh cannot be directly used in the computation of the finite element method. It is necessary to convert the surface mesh into FEA mesh for the successive analysis. This article gives an overview of the characteristics of STL surface mesh and finite element mesh, and an example demonstrates how to convert STL mesh to FEA mesh.

Triangular surface mesh

Triangular mesh refers to a surface model composed of triangular elements. It uses points and edges to form many small spatial triangles to approximate the surface of a 3D model. This approximation method is also used by most 3D mesh-based geometries. Using this primitive representation method, almost all 3D model surfaces can be approximated by using triangles. Due to the simple and quick processing of the triangular mesh, good visualization, and nice performance, it is regarded as one of the common methods to describe the 3D model. With the rapid development of computer graphics, triangular mesh models have been widely applied in many fields such as 3D animation, e-commerce, computer-aided design, manufacturing, and digital entertainment. Especially with the vigorous rise of 3D printing technology, the triangular surface mesh has become the focus of the 3D model representation method. At the same time, different data storage formats have been developed, among which STL, OFF, OBJ, PLY, etc. are widely used.

The STL format (short for Stereo Lithography) is an interface protocol developed by 3D Systems in 1988. It is a 3D graphics file format that serves rapid prototyping technology. The STL file is composed of a series of unordered triangular faces. The definition of each triangular face includes the coordinates of vertex and the normal vector of the triangular face. Note that the topological relationship between the triangular faces is not given in the file, the triangles are adjacent through sharing two vertices. Because of the simplicity and not prone to errors, STL has become the most commonly used file format and the de facto interface standard in the field of rapid prototyping technology. At present, almost all 3D printers on the market perform printing by recognizing STL models.

Another widely used triangle format is OFF (Object File Format). Unlike the STL file, the OFF file gives information about the number of vertices and the number of triangles and edges, but the OFF file does not indicate the normal vector of the triangles. OFF files are highly readable, the point set and face set is simple and clear. They all start with OFF keywords and are easy to identify. In addition to OFF files, PLY (Standford triangle mesh), OBJ and other surface meshes also have some applications in industry and academia. We will describe them in future articles.

3D mesh in FEA

Although there are some special types of elements in 3D finite element analysis, such as surface elements representing plates and shells, and line elements representing truss and beams. However, 3D solid elements are the most widely used. Commonly used solid elements are tetrahedral and hexahedral elements, which are widely used in 3D structural, thermal, fluid, acoustic, and electromagnetic simulations. The solid element not only has the overall surface information but also has discrete meshes inside. This difference also makes the FEA solid mesh more complex than the surface mesh represented by STL, and the amount of data is also much vaster.

Finite element mesh has relatively high requirements on the quality of the elements. The element cannot be over distorted. The mesh density needs to be moderate. The coarse mesh results in accurate problems. While the dense mesh leads to a heavy calculation burden. Some topologically complex areas also require dense mesh. The commonly used quantities for mesh quality are:

Jacobian ratio: The ratio of the Jacobian matrix derived from the global and local coordinates. The ideal value is 1, and it cannot be less than 0.

Aspect ratio: refers to the ratio of the longest side to the shortest side of the element. The ideal element has an aspect ratio of 1.

Skewness: A measure of the regularity of an element. The value ranges from 0 to 1. The smaller the value, the more ideal the element is.

The order of the element will also affect the results of the finite element analysis. Generally, the second-order element is better than the linear first-order element, but the increase in the number of nodes in the second-order element will also lead to a relatively expensive computation.

Convert STL mesh to FEA mesh

The general-purpose finite element software WelSim already supports the conversion of STL surface meshes into solid meshes for finite element analysis. Users can quickly complete the meshing projects by importing STL files, generate tetrahedral solid meshes (Tet4), and export FEA mesh files for subsequent finite element analysis.

The operation steps are as follows:

  1. In the WelSim software, create a new FEM Project, and select Import Geometry from the menu or toolbar. The following dialog box will pop up:

2. Select an STL file and click Open.

3. Because it is an STL geometric model, the triangle mesh lines are displayed by default, and the user can choose to hide the mesh line display in the properties view.

4. Simply set the maximum size of the element. Here, according to the entire size of the sample, we set the maximum element size to 10 mm. Click the Mesh All button to perform finite element meshing.

5. As shown in the figure below, a total of 4,025 nodes and 16,112 Tet4 elements are generated.

6. To save the generated finite element mesh data as a file, you can Right-click on the Mesh node and select Export Mesh. As shown below:

7. Currently, the supported mesh file formats are UNV, WelSim’s own format, Abaqus’ *.inp format, and Nastran’s *.bdf format, as shown in the figure below.

At this point, the STL mesh file has been converted into a solid mesh that can be used for finite element analysis (FEA) or computational fluid dynamics (CFD) analysis. The software operation video is attached at the end of this article for your reference.

Behaviors and Limitation

The current version of WelSim does not support Tet10 elements for STL-FEA mesh conversion.

WELSIM® finite element analysis software helps engineers and researchers conduct simulation studies and prototype virtual products.