Survey
* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project
* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project
MESTRADO EM ENGENHARIA MECÂNICA November 2014 APPLICATION OF ALGORITHMS FOR AUTOMATIC GENERATION OF HEXAHEDRAL FINITE ELEMENT MESHES Luís Miguel Rodrigues Reis Abstract. The accuracy of a finite element method analysis depends on the mesh quality of the domain discretization. Additionally, quadrilateral and hexahedral meshes presents several numerical advantages over triangular and tetrahedral ones. Thus, mesh generation of quadrilateral and hexahedral elements is a very important, complex and time demanding issue in finite element problems. Furthermore, most finite element commercial programs don’t have implemented the latest mesh generation algorithms. In this work some recent quadrilateral and hexahedral mesh generation algorithms were implemented in order to import meshes to commercial software or to use with in-house software. Receding front, level sets, medial axis and transfinite mapping algorithms were used in order to generate meshes of several 2D and 3D geometries. Element quality and distortion measure implemented uses the condition number of the Jacobian matrix. Quadrilateral and hexahedral meshes were generated for several geometries and meshes with good quality were obtained. 1 INTRODUCTION Mesh generation is a very complex and time demanding issue in a finite element analysis. Additionally, quadrilateral two-dimensional meshes present several numerical advantages when compared with triangular meshes [1]. For three-dimensional analysis, hexahedral elements have also some advantages over tetrahedral meshes [1]. On the other hand, in order to generate a quadrilateral or a hexahedral mesh, in commercial software, user has a tedious manual work to sub-divide the domain in quad or hex meshable sub-regions. But even so, sometimes quadrilateral or hexahedral meshes are not possible to generate or the final result is different from the idealized one. Thus, the implementation of mesh generation algorithms can be useful since import meshes in commercial software is usually possible and is also possible to use meshes with in-house finite element programs. Nowadays, none of the existent algorithms are robust and automatic in order to generate quadrilateral or hexahedral meshes for any initial geometry [2]. Grid-based and advancing front methods are almost automatic and robust. However both have some advantages and disadvantages. Grid-based methods generate a good inner mesh, since algorithm starts in the inner part of domain. Near the outside boundary elements have low-quality [2]. Thus, this method is not suitable for contact or blood flow problems, because interface mesh quality is an important issue. The advancing front family methods meshes are generated layer by layer following the shape of the boundary surface. Consequently, boundary elements have good-quality. However, these methods are less robust and automatic, because fronts can collide and create voids [2,3]. In the last decade, some new algorithms have been proposed. In fact, in order to avoid the main disadvantages of both methods and also to combine advantages, Ruiz-Gironés [1,2] proposed the receding front method. This method computes the layers of elements combining two solutions of the Eikonal equation. This procedure needs an inner boundary, if the domain hasn’t any hole inside, then the medial axis should be computed [4]. The receding front method wasn’t the first method using the Eikonal equation. In 1994, Sethian [5] presents a 2D mesh generation method that uses level set fronts and curvature. Other method, developed in the last decades, is the transfinite mapping (TFI) [6]. With this method is possible to mesh geometries with curved sides, like, for instance, the S-shape. This method could be also applied to domains with one dimension bigger than others and also with bifurcations. Quality and distortion measure of meshes is also an important issue, in order to compare elements quality. The condition number of the Jacobian matrix can measure the algebraic element quality in terms of Luís Miguel Rodrigues Reis the Jacobian of the mapping between an ideal and a physical element [7]. The objective of this work is to implement some quadrilateral and hexahedral mesh generation algorithms. In this way, some recent mesh generators methods are available to create meshes outside commercial finite element software. This could be important in order to have better meshes, since some commercial software doesn’t have the latest methods available. These methods may also be relevant for shape optimization analysis, in order to avoid stopping at all iterations to re-mesh the new geometry. It is also essential to avoid commercial software and use with in-house finite element software. 2 METHODS In this work the receding front method and transfinite mapping (TFI) method were implemented. Both methods are meshing generation algorithms to define quadrilateral and hexahedral elements. A method to define the medial axis was also implemented since it is necessary to define an inner boundary. Moreover, level set method is used to define the layers of elements in both receding method and TFI. An algebraic method to measure quality and distortion of finite elements was also applied. 2.1 Level set method A level set is, generally, a level curve or a level surface, or, in other words, an isoline or an isosurface. This curve, or surface, can move with a velocity f [8]. If velocity only depends on position the level set method reduces to Eikonal equation: d f in d U 0 (1) where f=1, is the euclidean norm, U is the 0-distance field and is the domain. In this case (f=1) the solution d is the distance from [1]. The Eikonal equation is solved on a triangular or a tetrahedral mesh by means of an edge-based solver [7]. To compute the node fronts, or the element layers, to be used in the receding front method, Eikonal method is solved for inner boundary ( in ) and outer boundary ( out ). Finally the combined result is obtained: u d out d out din (2) where din and dout are the solutions of (1) considering in and out , respectively. In figure 1 is possible to observe an example of the combined final result (u). Figure 1: a) triangular mesh to solve Eikonal problem, b) dout, c) din, d) u. 2 Luís Miguel Rodrigues Reis 2.2 Receding front method The receding front method combines the advancing front technique with the grid-based one. In the advancing front methods mesh is generated from outside to the inside of the domain. In the grid-based methods is the other way around, the mesh generation starts in the outer boundary to the inner limit. The receding front method uses a set of fronts, computed using the Eikonal equation (1) and the combined result presented in equation (2). Thus, with the receding front method is possible to generate good quadrilateral and hexahedral meshes near both boundaries and also inside de domain. If the domain hasn’t an inner boundary (an inner hole), the first step is to create an inner front or an inner boundary. To do so the medial axis is computed. Then, the receding front method is used to create the mesh between the outer boundary and the defined inner front (boundary). After this step, is necessary to generate the mesh inside the defined inner front. This inner front geometry definition is a very important issue for the final mesh quality. However, is still missing a perfect inner shape definition [1]. Could be tested several shapes and keep the best final shape, or use an optimization procedure to move nodes and maximize elements quality [9]. The receding front method generates a hexahedral mesh between an inner and an outer boundary. If boundaries have vertices and edges is necessary to use some templates to expand the elements to the next front [1]. This is one of the major disadvantages of the receding front method since is almost impossible to define templates to all boundaries [1]. But, templates can be added to algorithm, and difficulties can be avoided in future. Another problem is related with geometries with more than one interior hole. In this case domain should be divided in sub-domains with one hole each. Finally, the receding front algorithm has 5 steps [1]: i. Compute the medial axis of the domain (if necessary); ii. Generate the mesh inside de inner boundary (if necessary); iii. Compute the seeds in the inner boundary; iv. Compute level sets using equation (1) and (2); v. Generate layers of elements from the inner boundary to the outer boundary using the fronts computed in step iv. 2.3 Transfinite mapping method Transfinite mapping method (TFI) allows meshing extruded volumes in which the opposite logical sides should have the same number of nodes [6,10]. TFI has a starting surface and a target surface, and could also have linking sides [6]. Starting from the source surface, the opposite node in the target surface minimizes the distance between both nodes [6]. This method is well suited to the S-shape and all other similar curved shapes [6,10]. More recently some other procedures were added to TFI in order to improve the mesh and to increase the applicability to more domains, for instance with some vertices (not only in the starting and ending points). Optimizing the mesh quality [9] or penalizing the large distances between two consecutive nodes on the target surface, are two examples of other techniques that could be added to TFI. 2.4 Medial axis Medial axis can be necessary to create an inner boundary in order to use the receding front method. But, can also be essential to define an inner boundary to use TFI, especially if domain has one dimension bigger than others and bifurcations, like 2D geometry in figure 2. Figure 2: definition of medial axis. 3 Luís Miguel Rodrigues Reis The definition of medial axis used in this work is the one of Tamal K. Dey [4]: “the medial axis of a curve or a surface is meant to capture the middle of the shape bounded by ”. Definition 1. The medial axis M of a curve (surface) k is the closure of the set of points in k that have at least two closest points in [4]. 2.5 Quality and distortion measure For quality and distortion measure of elements the condition number of the Jacobian matrix [7,9,11]: J 1 J F J 1 3 for 3D meshes, and J is the Jacobian matrix and (3) F F represents the Frobenius norm. For two-dimensional meshes the condition number is given by: J 1 J F J 1 2 (4) F The element with the desired shape have J equal to one. All other elements have condition number greater than one. Thus, the greater is the condition number less quality and more distortion the element is. In order to have all results between zero and one the quality of an element is the inverse of the condition number, q 1 J (5) then 0 q 1, and the closer q is to 1, the better is the quality of the element. 3 RESULTS The implemented mesh generation algorithms were applied to 4 different domains, in order to compare results, validate methods and understand the aspects to improve. All meshes are parameterized in order to make several meshes with the desired number of elements per edge or surface. 3.1 2D mesh – five-pointed star The first domain is a benchmark domain [1], presented in figure 1, and receding front method was used. Star angles are not constant. In the upper part the angles are near 55 degrees, and in the other 3 edges the angles are greater than 90 degrees. In figure 1 is also possible to observe the level sets, or the layers of quadrilateral elements. In this example, the number of level sets and the number of nodes in each star edge is parameterized, so user can make their choice. In figures 3, 4 and 5 is possible to observe 3 different meshes with 7, 10 and 12 level fronts, respectively. It is also possible to verify that meshes have less quality near the upper part of star, due to the more acute angle. Like we can verify in table 1, meshes are good, with an average q always greater than 0.8. However, the minimum value is too small near the upper part of the star. To avoid this, a curvature flow, like the one presented in Sethian [5], should be implemented. Table 1: q for 2D – five-pointed star meshes. Mesh 3.1-1 3.1-2 3.1-3 Figure 3 4 5 Nº Elements 540 720 840 Minimum q 0.220 0.128 0.110 4 Maximum q 0.998 0.999 0.999 Average q 0.859 0.852 0.817 Luís Miguel Rodrigues Reis Figure 3: Mesh 3.1-1(5-pointed star) with 7 fronts and q. Figure 4: Mesh 3.1-2 (5-pointed star) with 10 fronts and q. Figure 5: Mesh 3.1-3 (5-pointed star) with 12 fronts and q. 3.2 2D mesh – medial axis The second geometry was inspired in medial axis example from the book of Dey [4], see figure 2. The medial axis was computed and then an inner boundary with straight lines was defined. Between the inner and outer limits the TFI was used. Inside the inner boundary a simple box mesh was generated. In the middle of the domain a small instability was applied, like in Sethian [5], in order to avoid triangular elements. In the bottom part of domain large distances between two consecutive nodes on the target surface were penalized. On the other regions no penalty was used, is a pure TFI algorithm. In this way is 5 Luís Miguel Rodrigues Reis possible to compare both techniques. In figures 6 and 7 is possible two observe to meshes and verify that the number of nodes per edge is important in mesh quality. It is also possible to verify that the penalization of large distance between two consecutive nodes in the target boundary improve the mesh quality. In table 2 is possible to verify the quality parameters, and q is less than 0.2 for the worst element, in the middle of domain. This could be improved with other types of instability, maybe a circular shape in the middle region. The average quality is always greater than 0.75. Figure 6: Mesh 3.2-1 (medial axis) and q. Figure 7: Mesh 3.2-2 (medial axis) and q. Table 2: q for 2D – medial axis meshes. Mesh 3.2-1 3.2-2 Figure 6 7 Nº Elements 821 705 Minimum q 0.193 0.188 Maximum q 1.000 1.000 Average q 0.805 0.768 3.3 3D mesh – sphere-cube This example is a 3D case: a hexahedral mesh of a sphere with a cube hole inside. The receding front method was applied to this example. In figure 8 is possible to observe the level set result (u computed with equation 2). Figure 8: level set (u) for sphere-cube mesh. 6 Luís Miguel Rodrigues Reis In figures 9 and 10 is possible to see two meshes. The first one has only 5400 elements, and the second one has 65664, as presented in table 3. This is possible because mesh generation is parameterized. In this example the average q is greater than 0.9 and the minimum value always larger than 0.6. Figure 9: Mesh 3.3-1 (sphere-cube) and q. Figure 10: Mesh 3.3-2 (sphere-cube) and q. Table 3: q for 3D – sphere-cube meshes. Mesh 3.3-1 3.3-2 Figure 9 10 Nº Elements 5400 65664 Minimum q 0.693 0.608 Maximum q 0.992 0.999 Average q 0.915 0.919 3.4 3D mesh – hip implant In this last example is presented a more complex geometry, and with contact surfaces. Near the interfaces, elements should have good quality to avoid errors in contact solution. In figure 11 is possible to observe the three parts involved: prosthesis, cement and femur. Figure 11: prosthesis (implant), cement and femur. Medial axis has computed to define an inner boundary in prosthesis. The inner boundary chosen is an ellipse, however maybe a rectangle is a better choice. The receding front method was used to generate all the mesh. In figures 12 and 13 is possible to observe the mesh of prosthesis, cement and femur for two distinct examples. In the first one (figure 12), prosthesis has a small flange in the proximal part. In the second case (figure 13), the flange is greater and more elements are used. In tables 4 and 5 is possible to verify the quality of both meshes. Tables have the quality of elements in each part, also. The minimum value 7 Luís Miguel Rodrigues Reis of q for prosthesis is a very low one. It should be tried other inner boundaries, different from ellipses, for instance a rectangle. Nevertheless, the quality of the elements in the interface is almost always greater than the average q, as is possible to observe in figures 12 and 13. In proximal part the interface elements are almost red, that means that q is almost equal to 1. For cement and femur the average quality results are greater than 0.5, and in femur the worst elements are far from the interfaces. Cement is a special case since has two interfaces. Figure 12: Mesh 3.4-1 (hip implant) and q. Figure 13: Mesh 3.4-2 (hip implant) and q. 8 Luís Miguel Rodrigues Reis Table 4: q for 3D – hip implant mesh 3.4-1. Part prosthesis Cement Femur Total Nº Elements 22400 4864 14336 41600 Minimum q 0.011 0.179 0.112 0.011 Maximum q 0.792 0.974 0.974 0.974 Average q 0.269 0.556 0.577 0.409 Table 5: q for 3D – hip implant mesh 3.4-2. Part prosthesis Cement Femur Total Nº Elements 91800 24624 60480 176904 Minimum q 0.024 0.323 0.195 0.024 Maximum q 0.990 0.972 0.992 0.992 Average q 0.520 0.777 0.795 0.650 The hip implant example is a more difficult one, but the receding front method was able to generate good hexahedral elements. However, different strategies for the definition of the inner boundary in the prosthesis layers are necessary in order to improve the implant mesh. With mesh generation algorithms implemented in this work is possible to define a mesh in several parts, with a good interface definition. Observe in figures 12 and 13 that interfaces nodes are coincident for both surfaces. This is also an essential issue to have better contact analysis. Additionally, the hip implant mesh generation allows shape optimization procedures, since algorithm is parameterized to implant, cement and femur geometric parameters. 4 FINAL REMARKS AND FUTURE WORK In this work some algorithms to generate quadrilateral and hexahedral meshes were implemented. These methods are recent and the major part of finite elements commercial software doesn’t have these algorithms available. With these algorithms is also possible to use in-house finite element software or make shape optimization analysis. In order to study the methods some examples were performed. The two-dimensional meshes obtained have good global quality. However, some improvements can be implemented. In fact, for the first example (five-pointed star) if level set curvature has fast changes, mesh could be improved with a curvature term like in Sethian work [5]. In the second example (medial axis) a penalization was introduced and good results were obtained when compared with the unchanged TFI. The large distance between two consecutive nodes penalization should be applied to all target line or surface. On the other hand, the mesh in the middle of the inner boundary should be improved with a circle instead of instability. Two examples of hexahedral meshes were also presented. The first one is an easy one in order to test the algorithm. However, an Abaqus® expert, with more than 15 years of experience, made a similar spherecube mesh and the best average q obtained was 0.808 and a minimum q equal to 0.294. It is an easy mesh, but even so the result obtained is much better compared with the mesh generated in Abaqus® commercial software. The last example is a more difficult one, due to geometric complexities and the two interfaces: femurcement and cement-prosthesis. Near the interface is important to have good elements and that was achieved. It was also possible to obtain coincident nodes in the interface, for both surfaces. However, prosthesis inner boundary, defined to make the level sets, should be changed to other solution, for instance a rectangle instead an ellipse. In the future, an optimization procedure should be added in order to change the nodes position to maximize elements global quality. Additionally, curvature flow should be added to receding front algorithm [5], and other shapes should be tried to describe inner boundary after medial axis definition. In the list of future works is also the development of an algorithm to mesh volumes with more than one hole inside. 9 Luís Miguel Rodrigues Reis In conclusion, the implementation of these mesh generation methods is important to have better quadrilateral and hexahedral meshes, and, consequently to have better finite element analysis. REFERENCES [1] Ruiz-Gironés E., Automatic Hexahedral Meshing Algorithms: From Structured to Unstructured Meshes, PhD thesis, Universitat Politècnica de Catalunya, 2011. [2] Ruiz-Gironés E., Roca X. and Sarrate J., “The receding front method applied to hexahedral mesh generation of exterior domains”, Engineering with Computers, 28, 391-408, 2012. [3] Ruiz-Gironés E., Roca X. and Sarrate J., “Unconstrained plastering—hexahedral mesh generation via advancing-front geometry decomposition”, International Journal for Numerical Methods in Engineering, 81, 135-171, 2010. [4] Dey T.K., Curve and Surface Reconstruction, Cambridge University Press, 2007. [5] Sethian J.A., “Curvature flow and entropy conditions applied to grid generation”, Journal of Computational Physics, 115(2), 440-454, 1994. [6] Roca X., Paving the Path Towards Automatic Hexahedral Mesh Generation, PhD thesis, Universitat Politècnica de Catalunya, 2009. [7] Knupp P.M., “Algebraic mesh quality metrics”, SIAM Journal on Scientific Computing, 23(1), 193-218, 2001. [8] Sethian J.A., Level Set Methods and Fast Marching Methods, Cambridge University Press, 1999. [9] Ruiz-Gironés E., Roca X. and Sarrate J., “Optimizing mesh distortion by hierarchical iteration relocation of the nodes on the CAD entities”, Procedia Engineering, (available online), 2014. [10] Gordon W.J. and Thiel L.C., “Transfinite mappings and their application to grid generation”, Numerical Grid Generation, 171-192, 1982. [11] Leng J., Xu G., Zhang Y. and Qian J., “Quality improvement of segmented hexahedral meshes using geometric flows”, Image-Based Geometric Modeling and Mesh Generation, Zhang Y. (eds.), Springer, 195-222, 2013. 10