Octree-based Generation of Hexahedral Element Meshes R. Schneiders R. Schindler F. Weiler Lehrstuhl fur Angewandte Mathematik, insb. Informatik RWTH Aachen Ahornstr. 55, 52056 Aachen, F.R. Germany email:
[email protected]
Abstract.
We present a new algorithm for the generation of hexahedral element meshes. The algorithm starts with an octree discretization of the interior of the input object which is converted to a conforming hexahedral element mesh. Then the isomorphism technique [9] is used to adapt the mesh to the object boundary.
keywords. hexahedra, mesh generation, octree 1 Introduction The last decades have seen immense progress in the development of numerical algorithms for the simulation of technical and physical processes. Finite element, nite dierence and nite volume methods are now routinely used in engineering. Therefore interest has grown in reducing simulation turnaround time, and the development of powerful, easy-to-use mesh generation programs has become an important issue. Much work has been done on algorithms for the generation of triangular, quadrilateral and tetrahedral element meshes. The state of the art is reviewed in [1], online information can be found in [2] and [3]. Mesh generators of this type have been integrated in many commercial programs. Unfortunately, the situation is worse in the eld of hex meshing. Most existing programs use mapped-meshing and multiblock techniques which require much user interaction and are therefore very time-consuming. Algorithms for the automatic generation of hexahedral element meshes have come up only recently, in essence the following techniques are used: { Medial surface based algorithms use the skeleton of on object as a starting point for calculating a decompostion into meshable subvolumes [4], [5] or extending a quadrilateral mesh on the skeleton to the object boundary [6]. { An advancing front type approach that makes use of the dual of the quadrilateral surface mesh [7] has been proposed in [8]. { Grid-based methods generate a structured grid which is then adapted to the object boundary by an isomorphism technique [9] or by a projection process [10], [11]. { For very complicated geometries with internal boundaries a decomposition approach has been proposed [12]. This paper presents a new octree-based algorithm for the generation of hexahedral element meshes. An octreestructure is an extension of a regular grid, and the algorithm uses many of the ideas of the grid based method presented in [9], especially for adapting the mesh to the object boundary. It inherits most properties of grid based algorithms, but avoids one of their major drawbacks, since the element size can be chosen with regard to the geometry or to the numerical error. In the following we present the general idea of the algorithm before going into the details. The principle of the algorithm is explained for the two-dimensional case; the application for the 3D case is straightforward. We close with a discussion of the algorithm, its present shortcomings and possible remediations.
2 The algorithm 2.1 General strategy The octree-algorithm is an extension of the grid based algorithm [9]. Fig. 1 shows how it works: The interior of the object is lled with a structured grid ( g. 1a), a minimum distance to the boundary is kept. The surface of the volume mesh can be regarded as a quadrilateral mesh (a polyhedron with quadrilateral faces only), and an isomorphic surface mesh is constructed on the object boundary ( g. 1b). Hexahedral elements in the boundary region are generated by connecting the nodes of corresponding quadrilateral faces ( g. 1c). Figure 1: Grid-based mesh generation a)
b)
c)
d c D a A
C b B
The method for connecting the mesh to the object boundary is called isomorphism technique, and the main problem to be solved in implementing it is to generate a good-quality mesh on the object boundary and to take care that the object edges are matched by mesh edges. This is achieved by a set of local operations on the boundary mesh that do not change it's topology. A short description of the technique is given in [9]. The isomorphism algorithm needs a polyhedron consisting of quadrilateral faces as a starting point, it does not make use of the volume mesh. In particular the surface mesh does not need to be the surface of a part of a structured grid, the initial mesh can be any kind of conforming hex mesh! Therefore a general meshing strategy based on the isomorphism technique can be stated as follows: { Generate a conforming mesh of hexahedral elements in the object interior, { extract the surface of the mesh, { use the isomorphism technique to mesh the remaining region near to the boundary. The octree-algorithm is based on this strategy (see g. 2 as an example):
A special kind of octree decomposition is used as a starting point ( g. 2a). The main problem to be solved in this step is to make sure that the octant size is well adapted to the geometry. The octree structure is converted into a conforming hex mesh with a modi cation of the mesh re nement algorithm presented in [13]. Then the isomorphism technique is used to extend the mesh to the boundary.
These steps are described in detail in the next three sections.
2.2 Construction of the initial octree The octree is a well-known tool for organizing spatial data with applications in solid modelling, mesh generation [14] and various other elds. In the following we use a modi ed octree concept where one starts with a cube that contains the object (root octant). The cube is split up into 27 subcubes (octants) which are re ned recursively until the sizes of all octants fall below a prede ned threshold ( g. 3 gives an example). In the standard octree decomposition method an octant is split up into 8 suboctants. The \27-tree" is chosen because a conforming hex mesh can be derived more easily from this structure. For sake of simplicity we use the terms \octree" and \octant" for the 27-tree and for their 2D-counterparts.
Figure 2: Octree-based mesh generation b)
a)
c)
Figure 3: Octree decomposition 0 1 2
The octree structure is later used as a building block for the hex mesh. Due to the underying structure octree-based meshes can be re ned and coarsened eciently. Since the size of the elements of the hex mesh is determined by the size of the octants, the octants must be small enough to meet all geometrical requirements (small features of the object must be represented, and the size of near-boundary octants must be chosen with regard to the local curvature in order to limit the loss of volume). The required accuracy of the numerical solution imposes another limit on the octant size (this information is problem-dependent and can be derived from an appropriate error estimator). The desired mesh density is usually represented with the help of a background mesh. For sake of simplicity, another approach is chosen: Local density is represented by a set of points with associated maximum edge lengths (Pi ; hi ). Despite the fact that one needs more points compared to the background mesh technique, it was chosen because it can more easily be integrated into an octree framework. Fig. 4a shows an example that will be used for explaining the algorithm (for ease of understanding we will explain most of the techniques for the 2D case, the extension for 3D is straightforward). The initial octree is then constructed as follows: A bounding box that contains the entire object is chosen as a root octant. The size of the bounding box should not exceed the size of the minimal bounding box by a factor 3, since otherwise too many useless octants would be generated. This contributes to the robustness of the algorithm, since it can be restarted with another root octant if mesh generation fails. The following recursive algorithm constructs the initial octree:
Figure 4: Mesh density information and initial octree a)
b)
procedure refine_octant begin if the octant contains a point p whose associated edge length is smaller than the octant size then split up the octant into 9 (27) octants; for all new octants o_i refine_octant ( o_i ); end; refine_octant ( root_octant );
Fig. 4b shows the initial octree for the example shape. It remains to explain how the point-density information is generated from an object description. The rst idea is to specify boxes with given densities, it is then easy to generate an appropriate point distribution. It is also straightforward how to generate the point distribution with the help of an error estimator. It is, however, more important to detect small features of the object automatically. Since we are more concerned with mesh generation, we did not solve the problem completely but developed heuristics that work well for most practical problems:
In the scanline approach rays are used to detect the small features of the geometry ( g. 5a). The points are placed on the part of the ray that intersects the object interior. For the circumsphere technique each boundary triangle is assigned to the maximum sphere (circle) that satis es the Delauny-empty-sphere-criterion (the midpoint of the circle should be as closed to the object interior as possible, g. 5b). The midpoint of the tetrahedron/triangle de ned by the touching points, together with the radius of the sphere/circle, gives the feature information. This approach is similar to the voronoi-based construction of the medial surface (the newly de ned points approximate the object skeleton). One can estimate the curvature of the object boundary and distribute points according to that information.
All heuristics work for the 2D and 3D case. Fig. 6 shows a simple geometry with a re nement requirement located at the boundary and the initial octree structure. The purpose of the work described in this paper was to develop an algorithm for adaptive hex meshing, and we did not give much attention on the question how to derive and store density information. Both the scanline approach and the circumsphere technique are cannot guarantee to nd all small features of an object. Detecting small features is a non-trivial problem; it can be solved with medial surface or voronoi-based techniques.
Figure 5: Scanline- and circumsphere technique a)
b)
Figure 6: Three-dimensional re nement requirement
2.3 Conversion to a conforming hex mesh The meshes generated so far have hanging nodes and are thus not useful for nite element calculations (in CFD the situation is dierent, [19]). The meshes must be conforming, that means that two distinct, adjacent elements intersect at commmon nodes, edges or faces only. The octree structure must thus be converted to a conforming hex mesh by building the \conforming closure". The problem of nding the conforming closure is very similar to the mesh re nement problem, and the method is a modi cation of the mesh re nement algorithm proposed in [13]. Again, we will explain the 2D-algorithm rst, then we discuss the 3D algorithm. Because of the underlying tree structrure, all octants can be assigned a level l ( g. 3). The root octant has level l = 0, while the level of an arbitrary octant os is determined by the level of it's father octant of in the octree structure: l(os) = l(of ) + 1 ( g. 7a shows the level assignments for a part of the example octree). Nodal subdivision levels are de ned as the maximum subdivision level of the adjacent elements ( g. 7b). Figure 7: Octant and node levels a)
b) 2
2
2
4
2
2
2 4
3
3 2
2
3
3
3
3
3
3
3
2
2 2
3
3 3
3
3
3
3
3
3
3
3
2
2
The hanging nodes at adjacent octants with diering levels are removed by inserting appropriate templates from the list shown in g. 8. The nodal subdivision levels help to nd the correct template. Consider an arbitrary octant o with level l(o): The nodes v of o with level l(v) > l(o) are marked ( g. 9a). The con guration of the marked nodes uniquely determines the template from g. 8 that is used to split up o. Fig. 9a shows the result after all octants with level 2 have been processed (the templates 1 and 2a were used). Figure 8: 2D templates 0:
1:
2a:
2b:
3:
4:
The newly generated nodes and faces are assigned to the level l(o) + 1. This procedure is repeated until no hanging nodes are left ( g. 9b). Figure 9: Construction of the conforming closure a)
b) 2
2
2
2
2
2
2
2
4 4 3 2
2
3
3
3
3
3
3
3
3
3
3
3
2
2
2
2
3
3
3
3
3
3
3
3
3
3
3
3
2
2
Formally the algorithm can be stated as follows: procedure conforming_closure for l = 0 to maximum_level for all octants with level l mark nodes v with level(v) > l; insert appropriate template; set new levels;
In [13] it is shown that the algorithm results in a conforming mesh and that it is stable (the minimum angle min in the transition elements does not depend on the maximum subdivision level, here min = 45o ). Fig. 10 shows how the algorithm proceeds for the example octree of g. 4. It should be mentioned here that there exist other sets of templates (e.g. a four-element set). The proposed set is used since the quality of the elements in the transition does not decrease with increasing levels of re nement ( g. 10, see also [13]). It is simple to give a similar algorithm for nding the conforming closure of a 3D octree structure. The node levels are de ned as the maximum level of the adjacent octants, the nodes v of an octant o with level l(v) > l(o) are marked, and appropriate templates are inserted. Fig. 11 shows 5 out of 22 necessary templates (see [15] for a complete list). Note that the faces are split up in the same manner as shown in g. 8, which ensures conformity of the mesh ([13]). The templates 2{5 in g. 11 form an important subclass: They are needed for the construction of the conforming hull of \convex" sets of higher-level octants ( g. 6 is an example) and are very important in practice. Fig. 12 gives a detailed view of these templates. Template 6 in g. 11 poses a problem: Its surface consists of 51 quadrilateral faces (there are 27 hidden faces on the back), so that there does not exist a corresponding 3D mesh [7]. It follows that one cannot nd a conforming closure for an octree structure that contains this \concave corner" (a subdivision level assignemt which enforces the use of template 6, g. 13 shows an example). In this case, the algorithm must be modi ed in one of the following ways:
Figure 10: Generation of the conforming closure a)
b)
1
2
Figure 11: Selected 3D-templates 3 4 5
6
a) The lower-level octants are split up until template 6 is no longer necessary ( g. 13a). For some situations, this can lead to an unacceptable increase of the number of elements. b) A buer-layer is inserted in the octree structure ( g. 13b). Then the conforming closure can be constructed with template 4 only. With this technique one can construct the conforming hull for arbitrary non-conforming octrees, at the cost of losing the underlying octree structure of the mesh which makes subsequent re nement and coarsening very dicult. A compromise between the two techniques may be the best solution to the problem: The rst method is chosen if not too many new octants are inserted, otherwise a buer-layer is inserted in the octree structure.
2.4 Adapting the mesh to the boundary The mesh is adapted to the boundary with a slightly modi ed isomorphism technique [9]. In order to apply this technique, a subset of the conforming mesh is selected as an initial mesh. This must be done in a way that the distance of each quadrilateral face f on the surface of the initial mesh roughly equals its diameter (in order to allow for the generation of elements with acceptable aspect ratio): 1. All nodes that are outside the object and the elements adjacent to them are removed. 2. The characteristic distance of a node is de ned as
d(v) = n1
X
f adjacent to v
diam(f )
(1)
(n is the number of faces f that are adjacent to v). The nodes v whose distance h to the object boundary satis es h < 0:5 d(v) and the adjacent elements are removed from the initial mesh. Fig. 14a shows the result for the 2D example, g. 15a the initial mesh for the re nement requirement given in g. 6.
Figure 12: 3D templates - details
Figure 13: Concave octree structure a) b)
Then the isomorphism technique is used to mesh the remaining region near the boundary with an additional layer of elements ( g. 14b and g. 15b). A smoothing is performed for the interior nodes v of the mesh according to the Laplacian rule 1 xnew i =N
XS N
(2)
k
k=1
(Sk denote the midpoints of the N elements adjacent to v). Surprisingly, Laplacian smoothing works very well for unstructured hexahedral element meshes. (2), combined with a reprojection step, is also applied to those surface nodes of a hexahedral element mesh that do not fall on a characteristic edge. The mesh nodes v on characteristic edges (and the boundary nodes in the 2D case) are smoothed according to the following rule: 1 xnew i = d(v ) + d(v ) (d(vl) xl + d(vr ) xr ) l
r
(3)
where vl and vr are the neighbor nodes on the characteristic edge with weights d(vl ) and d(vr ) de ned by ( g. 1).
Figure 14: Adapting the mesh to the boundary a)
b)
Figure 15: Initial mesh and hex mesh for a block a)
b)
3 Discussion The octree algorithm falls in the class of grid-based mesh generators and shares many of their strong and weak points. Sabin [16] has proposed nine criteria for evaluating mesh generating algorithms, [17] discusses the qualities of the grid based algorithm with respect to the Sabin-criteria. Regarding the octree algorithm, the following is important:
The algorithm generates all-hexahedral element meshes without degenerated elements for arbitrary eulerian solids (without internal faces). With respect to some restrictions, mesh density can be controlled (see below). The size of the root octant can be chosen arbitrarily if it contains the object to be meshed. The algorithm can be started with dierent root octants, a fact that makes the algorithm very robust. Element quality is very good in the interior of the mesh, the relatively worst elements are at the surface. Mesh generation is not invariant under rigid body transformations. Due to the underlying structure octree-based meshes can be closely adapted to adaptive numerical algorithms.
Mesh density control is the most important point, and its current limitations and possible remediations have already been mentioned in section 2.3. The problem of how to nd the conforming closure is equivalent to the problem of re ning hexahedral element meshes, and a solution of the mesh re nement problem would directly give an algorithm for nding the conforming closure. Until now no complete set of transitioning elements (templates) has been found. If one has a set of templates that do all have an even number of faces, the spatial twist continuum technique [7] can
be applied to construct meshes for the templates. At the moment, one has to accept the introduction of a buer layer in the mesh for \non convex" octrees. There are several variations of the proposed algorithm:
It is planned to develop a similar algorithm based on the use of a classical (1-8-) octree. In this case the construction of the conforming hull is more dicult, since it cannot be done in a purely local manner [13]. \Non-convex" octrees must be handled with the buer technique. If one accepts the use of tetrahedra and pyramids, one can nd a complete set of templates for the classical octree [18]. The isomorphism technique would have to be modi ed in order to allow for the generation of prisms in the boundary region. A set of templates based on hexahedra, tetrahedra and prisms has not yet been found. If one can nd a mesh for the pyramid that respects the surface given in g. 16, one can even construct a complete set of templates with hexahedral elements by combining this mesh and the \mixed" templates. As outlined in [7], such a mesh exists, but a solution has not yet been published. In CFD, solvers exist that can deal with hanging nodes. In this case mesh generation is far less a problem, since one does not need to nd the conforming closure (the meshing of the boundary region becomes more dicult). This idea has already been realized [19]. The isomorphism technique for adapting a volume mesh to the boundary of an object does not necessarily need octree- or grid-type meshes as a starting point, but can be used with arbitrary initial meshes. Figure 16: Pyramid
In summary, the octree is a useful concept for mesh generation, and its potential has not yet been fully employed.
References [1] J.F. Thompson (1996): A re ection on grid generation in the 90's: Trends, needs, in uences. Proc. 5th International Conference on Numerical Grid Generation in Computational Field Simulations, pp. 679-688 [2] S. Owen (1996): Meshing Research Corner. Literature database, available at URL http://www.ce.cmu.edu/~sowen/mesh.html
[3] R. Schneiders (1996): Information on Finite Element Mesh Generation. Web page, URL http://www-users.informatik.rwth-aachen.de/~roberts/meshgeneration.html
[4] M.A. Price, C.G. Armstrong and M.A. Sabin (1995): Hexahedral Mesh Generation by Medial Axis Subdivision: I. Solids with convex edges. Int. Jou. Num. Meth. Eng. 38 [5] D. Holmes (1995): Generalized Method of Decomposing Solid Geometry into Hexahedron Finite Elements. Proceedings 4th International Meshing Roundtable, Sandia National Laboratories, pp. 141-152 [6] G.M. Turkkiyah, M.A. Ganter, Duane W. Storti and Hao Chen (1995): Skeleton-Based Hexahedral Finite Element Mesh Generation of General 3D Solids. Proceedings 4th International Meshing Roundtable, Sandia National Laboratories, late addition [7] S.A. Mitchell (1996): A characterization of the quadrilateral meshes of a surface which admit a compatible hexahedral mesh of the enclosed volume. Proceedings STACS'96, Grenoble [8] T.J. Tautges, S. Mitchell (1995): Whisker Weaving: Invalid Connectivity Resolution and Primal Construction Algorithm. Proceedings 4th International Meshing Roundtable, Sandia National Laboratories, pp. 115-128 [9] R. Schneiders (1995): Automatic generation of hexahedral nite element meshes. Proc. 4th International Meshing Roundtable, Sandia National Laboratories, pp. 103-114
[10] R. Taghavi (1994): Automatic, parallel and fault tolerant mesh generation from CAD on Cray research supercomputers. Proc. CUG Conference, Tours, France [11] D. Ives (1995): Geometric Grid Generation. Surface Modeling, Grid Generation, and Related Issues in Computational Fluid Dynamic (CFD) Solutions. Proceedings NASA-conference, Cleveland, Ohio, NASA CP-3291 [12] T. Taniguchi (1996): New Concept of Hexahedral Mesh Generation for Arbitrary 3D Domain { Block Degeneration Method. Proc. 5th International Conference on Numerical Grid Generation in Computational Field Simulations, pp. 671-678 [13] R. Schneiders (1996): Re ning Quadrilateral and Hexahedral Element Meshes. Proc. 5th International Conference on Numerical Grid Generation in Computational Field Simulations, pp. 699-708 [14] M.S. Shephard, M.K. George (1991): Automatic three-dimensional mesh generation by the nite octreetechnique. Int. Jou. Num. Meth. Eng. 32, pp. 709-750 [15] F. Weiler, R. Schindler and R. Schneiders (1996): Automatic Geometry-Adaptive Generation of Quadrilateral and Hexahedral Element Meshes for the FEM. Numerical Grid Generation in Computational Field Simulations, pp. 689-697 [16] M. Sabin (1991): Criteria for comparison of automatic mesh generation methods. Adv. Eng. Softw. 13, pp. 220-225 [17] R. Schneiders (1996): A grid-based algorithm for the generation of hexahedral element meshes. To appear in Engineering with Computers [18] R. Schneiders, J. Debye (1995): Re nement Algorithms for Unstructured Quadrilateral or Brick Element Meshes. Modeling, Mesh Generation and Adaptive Numerical Methods for Partial Dierential Equations. IMA Volume (1995) [19] R.J. Smith and M.A. Leschziner (1996): A Novel Approach to Engineering Computations for Complex Aerodynamic Flows. Proc. 5th International Conference on Numerical Grid Generation in Computational Field Simulations, pp. 709-716
Acknowledgements The authors acknowledge the support of the project by the Deutsche Forschungsgemeinschaft under grant Ko 579/442.