Multi-Domain Constrained Triangulations Using Off-the-shelf ...

20
Multi-Domain Constrained Triangulations Using Off-the-shelf Libraries Paulo Roma Cavalcanti 1,2 [email protected] Yalmar Ponce Atencio 1 [email protected] Claudio Esperanc ¸a 1 [email protected] Flavio Pereira Nascimento 1 [email protected] Universidade Federal do Rio de Janeiro COPPE Sistemas, LCG 1 Department of Computer Science, IM 2 Bloco H do CT, Cidade Universit´ aria Ilha do Fund˜ ao, 21941-972, RJ, Rio de Janeiro, Brasil Abstract. The problem of building non-structured 3D meshes for use in numerical simulations has been intensively studied in the last three decades. Several aspects of the process have been focused, such as: how to subdivide domains into collections of tetrahedra while avoiding degenerate elements; how to use finer spatial resolutions in order to favor certain regions of the domains; how to maintain the integrity of the mesh as parts of the domains change in time. All of these problems are contingent on a proper representation of the domain to be meshed. It is common to assume domains represented by manifolds having polyhedral geometry, but these comprise a small fraction of the problems of interest. In particular, problems in geology frequently are stated by means of non-manifold domains. The present paper focuses on how to use off-the shelf software, which is capable of triangulating polyhedral manifolds, to construct triangulations for non-manifold domains. Keywords: 3D Constrained Triangulations, mesh optimization, multi-domain triangulations CILAMCE 2013 Proceedings of the XXXIV Iberian Latin-American Congress on Computational Methods in Engineering Z.J.G.N Del Prado (Editor), ABMEC, Piren ´ opolis, GO, Brazil, November 10-13, 2013

Transcript of Multi-Domain Constrained Triangulations Using Off-the-shelf ...

Multi-Domain Constrained Triangulations Using Off-the-shelf Libraries

Paulo Roma Cavalcanti1,2

[email protected] Ponce Atencio1

[email protected] Esperanca1

[email protected] Pereira Nascimento1

[email protected]

Universidade Federal do Rio de JaneiroCOPPE Sistemas, LCG1

Department of Computer Science, IM2

Bloco H do CT, Cidade UniversitariaIlha do Fundao, 21941-972, RJ, Rio de Janeiro, Brasil

Abstract. The problem of building non-structured 3D meshes for use in numerical simulationshas been intensively studied in the last three decades. Several aspects of the process have beenfocused, such as: how to subdivide domains into collections of tetrahedra while avoiding degenerateelements; how to use finer spatial resolutions in order to favor certain regions of the domains;how to maintain the integrity of the mesh as parts of the domains change in time. All of theseproblems are contingent on a proper representation of the domain to be meshed. It is common toassume domains represented by manifolds having polyhedral geometry, but these comprise a smallfraction of the problems of interest. In particular, problems in geology frequently are stated bymeans of non-manifold domains. The present paper focuses on how to use off-the shelf software,which is capable of triangulating polyhedral manifolds, to construct triangulations for non-manifolddomains.

Keywords: 3D Constrained Triangulations, mesh optimization, multi-domain triangulations

CILAMCE 2013Proceedings of the XXXIV Iberian Latin-American Congress on Computational Methods in Engineering

Z.J.G.N Del Prado (Editor), ABMEC, Pirenopolis, GO, Brazil, November 10-13, 2013

Multi-Domain Constrained Triangulations Using Off-the-shelf Libraries

1 Introduction

In an attempt to understand the evolution over time of some complex phenomena of the realworld, scientists have been using all kinds of simulations for showing the real effects on a givensystem under alternative conditions and obtaining appropriate courses of action.

Simulations are also used when the real system cannot be accessed or does not exist yet, andcomputers may come in handy when there is a hazard either for the environment or in the participa-tion of a human being in an experiment, or when the costs of building real equipment is prohibitive.

Nonetheless, it is also possible to use simulations for minimizing the risk of economicallosses in the prospection of natural resources, such as oil, where failures generally are mea-sured in hundreds of millions of dollars. As a matter of fact, numerical simulations always re-quire the discretization of a mathematical model, and the decomposition of the corresponding ge-ometrical domain into simple pieces, such as tetrahedra or hexahedra, so that either finite element[Zienkiewicz et al., 2005], or finite difference [Levy and Lessman, 1992] methods can be applied.This decomposition produces a data structure called a mesh [George and Frey, 2008].

The robust generation of non-structured 3D meshes is fundamental in several areas of theapplied sciences, such as Finite Element Analysis, Computer Graphics, Geo-sciences, Engineering,etc. The mesh generation is the process of decomposing a domain into a set of simplices satisfyingcertain geometrical criteria, in order to allow its usage in several kinds of simulations, for example,the evolution of sedimentary basins and multiphase fluid flow within sediments.

Algorithms for mesh generation have been an active research topic in the past threedecades [Owen, 1998], and three main families of algorithms have emerged: Octree based meth-ods [Schroeder and Shephard, 1990, Shephard and Georges, 1991, Saxena et al., 1995], Delaunaybased methods [Cheng et al., 2012, Watson, 1981, Joe, 1989, Joe, 1991, Shewchuk, 1997] and Ad-vancing Front methods [Lohner, 1988, Barth and Jesperson, 1989, Mavriplis, 1992, Lohner, 1996].

Depending on the purpose of the application, the mesh generation algorithm may or may nothonor the boundary of the underlying model, which means that the boundary of the original modelcan only be approximated in the final mesh. Nonetheless, one of the main sources of difficultiesin any Computational Geometry algorithm is the finite precision nature of the calculations per-formed by digital computers. Therefore, the robustness of the algorithms is a main concern in anyimplementation used for production.

This paper presents a 3D mesh generator which can be used for triangulating any 3D non-manifold model given as a set of polygonal surfaces, such as those in Figure 1 and Figure 4. Theimplementation uses the CGAL library (http://www.cgal.org) for several of its data structuresin order to achieve robustness. Although the CGAL library has procedures to produce a 2D or 3DDelaunay triangulation from a cloud of points, the creation of constrained triangulations is still lim-ited, mainly because CGAL does not have a general and easy way of inputting complex geometricmodels. As a consequence, CGAL is only able to create meshes of domains given by a manifoldsurface mesh, or multi-region domains given by the evaluation of an implicit (scalar) function. Inany case, the boundary of the domain is, in general, only approximated in the resulting mesh (Fig-ure 3). In particular, unidimensional and bidimensional elements present in the input in the form of

CILAMCE 2013Proceedings of the XXXIV Iberian Latin-American Congress on Computational Methods in EngineeringZ.J.G.N Del Prado (Editor), ABMEC, Pirenopolis, GO, Brazil, November 10-13, 2013

P. R. Cavalcanti, Y. P. Atencio, C. Esperanca, F. P. Nascimento

edges and triangles may not be reproduced in the output, not even in a subdivided form. Althoughthe CGAL package Mesh 3 allows sharp features for polyhedra, (that is, manifold models) there isstill a necessity to input non-manifold models, defined by a set of polygonal surfaces.

Figure 1: Gulf of Mexico: multi-domainmodel with six regions.

Figure 2: Triangulation and histogram of minimum di-hedral angles, before and after mesh optmization.

Figure 3: Implicit sub-domains generated from a multi-region model and the corresponding triangulation.

To cope with such limitations, we developed a methodology for inputting and representing 3Dnon-manifold models, which partitions the space into a set of 3D regions, by using only the toolsavailable in the CGAL library. Our algorithm first creates a Delaunay triangulation of the inputmodel, and then recovers all of its missing edges and faces. We have also implemented a meshimprovement phase to increase the quality of the final mesh.

2 Input Model

The CGAL library has functions for inputting models, either bounded by a 2D manifold sur-face mesh, or defined by an implicit function. Unfortunately, multi-region models defined by sev-eral non-manifold surface meshes can not be input directly, but only implicitly, by means of ascalar field. This is due to the fact that surface boundaries are routinely represented by Half-Edgedata structures in the CGAL library, which are not amenable to describing non-manifold domains.Nonetheless, there are several important applications where the domain must be represented by a

CILAMCE 2013Proceedings of the XXXIV Iberian Latin-American Congress on Computational Methods in Engineering

Z.J.G.N Del Prado (Editor), ABMEC, Pirenopolis, GO, Brazil, November 10-13, 2013

Multi-Domain Constrained Triangulations Using Off-the-shelf Libraries

Figure 4: Dragon triangulation with 690,000 tetrahedraand 100,000 vertices.

Figure 5: Detail showing the adaptive distributionof tetrahedra.

3D non-manifold model, possibly with dangling faces, which cannot be appropriately described byan implicit function. To deal with such kinds of complex models, we propose a feasible solutionby breaking the model into a set of simple surface patches, we call “fragments”.

Furthermore, the 3D triangulation of multi-region models requires an scheme for attachingattributes to every surface or region presented in the domain, so one can set properties to be usedby a simulation process.

Therefore, our data structure defines the following elements:

Vertex: represents a vertex of the model, with its coordinates, x, y, z, and possesses a uniqueidentifier, called the vertex index.

Face: is a set of loops, which describes a face of the model, and has a unique identifier calledthe face index. Each loop is a circular list of vertices, and refers to a boundary curve of theface. Faces containing more than one loop or containing only one loop with more than threevertices are triangulated by the system (see Fig. 6).

Fragment: is a list of connected faces identified by a unique fragment index. This way, eachfragment corresponds to a surface patch used in the construction of the input model. In theparticular case of a Geo-science model, it can be a horizon, a fault, or a face of the modelbounding box. Each face between two adjacent regions belongs to the same fragment. Also,every face in a fragment must have the same attribute set.

Region: is composed by a list of fragment indices, corresponding to faces with the same orien-tation. This way, for each region, a fragment list has faces oriented in the clockwise order,while its adjacent region is traversed in counter-clockwise order. The region is identified bya unique region index.

A model is stored and passed to the triangulator in the form of an xml file, and its structure,corresponding to the model on Figure 7, is listed below. The data structure allows an arbitrarytopology, including faces with internal disconnected loops (Figure 6), dangling faces, etc.

CILAMCE 2013Proceedings of the XXXIV Iberian Latin-American Congress on Computational Methods in EngineeringZ.J.G.N Del Prado (Editor), ABMEC, Pirenopolis, GO, Brazil, November 10-13, 2013

P. R. Cavalcanti, Y. P. Atencio, C. Esperanca, F. P. Nascimento

<Model>

<Vertices>

<Vertex id="1"> +0.0 +0.0 +0.0 </Vertex>

<Vertex id="2"> +1.0 +0.0 +0.0 </Vertex>

<Vertex id="3"> +8.0 +0.0 +2.0 </Vertex>

...

</Vertices>

<Faces>

<Face id="16" size="4" loops="1">

<Loop id="31" size="4"> 4 8 16 14 </Loop>

</Face>

<Face id="15" size="4" loops="1">

<Loop id="29" size="4"> 3 13 14 4 </Loop>

</Face>

<Face id="14" size="4" loops="1">

<Loop id="27" size="4"> 6 3 13 15 </Loop>

</Face>

<Face id="13" size="4" loops="1">

<Loop id="25" size="4"> 8 6 15 16 </Loop>

</Face>

<Face id="12" size="4" loops="2">

<Loop id="23" size="4"> 9 10 12 11 </Loop>

<Loop id="33" size="4"> 13 14 16 15 </Loop>

</Face>

...

</Faces>

<Fragments>

<Fragment id="1" size="6" indices="1"> 16 14 13 12 8 6 </Fragment>

<Fragment id="2" size="4" indices="1"> 15 7 5 4 </Fragment>

</Fragments>

<Regions>

<Region id="1" indices="1">

<CWFrags size="1"> 1 </CWFrags>

<CCWFrags size="1"> 2 </CCWFrags>

</Region>

<Region id="2" indices="0">

<CWFrags size="1"> 2 </CWFrags>

<CCWFrags size="1"> 1 </CCWFrags>

</Region>

</Regions>

</Model>

Figure 6: Faces with loops: before and after tesselation.

CILAMCE 2013Proceedings of the XXXIV Iberian Latin-American Congress on Computational Methods in Engineering

Z.J.G.N Del Prado (Editor), ABMEC, Pirenopolis, GO, Brazil, November 10-13, 2013

Multi-Domain Constrained Triangulations Using Off-the-shelf Libraries

Figure 7: Solid with genus 1: 16 vertices, 10 faces and 2 regions (one external).

3 3D Constrained Triangulation

The CGAL library supports 3D constrained triangulations by means of two templated classes,namely Polyhedral mesh domain 3, which defines restrictions given by a closed polyhedron,and Implicit mesh domain 3, where restrictions are represented as an iso-surface of an implicitfunction. While the former is clearly unable to represent non-closed domains, the latter, in theory,could be adapted to our purposes by defining a distance function which evaluates to zero at ver-tices, edges and triangles of the input. This approach was indeed implemented (see Fig. 3), butunfortunately the resulting triangulation is unable to faithfully reproduce certain sharp features ofthe input, which is unacceptable in many simulation contexts.

Thus, our triangulation algorithm employs the standard CGAL Delaunay engine to triangulatethe convex hull of the vertices of the model and detects the set of edges and faces present in theinput model, but absent in the Delaunay triangulation. These missing elements are introduced oneby one to produce a constrained triangulation, which contains all of the vertices, edges and faces ofthe input surfaces.

The algorithm is described in [Cavalcanti and Mello, 1999], which can be summarized in fivesteps:

1. Convex hull: the triangulation of the convex hull defined by the vertices of the input modelis created.

2. Edge recovery: the missing edges, that is, the edges of the input model that are not in theDelaunay triangulation, created in step 1, are inserted into the triangulation.

3. Face recovery: the missing polygonal faces of the input model are inserted into the triangu-lation.

4. Classification: all of the simplices of the triangulation are classified relatively to the inputmodel. This way, all tetrahedra will be associated to the region of the space in which it iscontained.

CILAMCE 2013Proceedings of the XXXIV Iberian Latin-American Congress on Computational Methods in EngineeringZ.J.G.N Del Prado (Editor), ABMEC, Pirenopolis, GO, Brazil, November 10-13, 2013

P. R. Cavalcanti, Y. P. Atencio, C. Esperanca, F. P. Nascimento

5. Mesh improvement: a series of transformations are applied to the mesh to improve the shapesof its faces/tetrahedra.

Some auxiliary data structures are necessary to keep the consistency between the original modeland the triangulation. The input model is represented by a set of fragments, which must be keptup-to-date during the triangulation, so that any new vertex, edge or face created is also inserted intothe model.

3.1 Steiner Points

The regions of the model must be filled with auxiliary (Steiner) points, so the point distributionpermits the generation of good shaped tetrahedra (Figure 9). For this purpose, a grid is defined inthe model bounding box (Figure 8), and points keeping a minimum distance from all surfaces areinserted into the model. The position of these points can be determined by three types of lattices:cubic, hexagonal [Mello and Cavalcanti, 2000], and adaptive. In any case, an octree is kept foravoiding the insertion of points too close to a face of the model. The subdivision goal is to achievea configuration where there are at most three faces per cell. Each point is then tested against thefaces of the cells it interferes with [Stocco and Schrack, 1995], before being added to the model.Figure 10 points out the threshold (depicted as a yellow circle), used to find out the closest face tothe given point. The threshold is a function of the distance between two adjacent grid vertices.

Figure 8: Grids For The Placement of Auxiliary Points.

Figure 9: Auxiliary Points filling empty space. Figure 10: Auxiliary Octree.

CILAMCE 2013Proceedings of the XXXIV Iberian Latin-American Congress on Computational Methods in Engineering

Z.J.G.N Del Prado (Editor), ABMEC, Pirenopolis, GO, Brazil, November 10-13, 2013

Multi-Domain Constrained Triangulations Using Off-the-shelf Libraries

3.2 Edge Recovery

Edge recovery implies checking which constrained edges are missing from the triangulation ofthe model’s convex hull, and forcing its appearance in the final triangulation.

The process of edge recovery we used is known as stitching [Weatherill, 1992,Weatherill and Hassan, 1994] and, is based on the insertion of vertices on a missing edge. Thisprocess works because in a Delaunay triangulation each vertex is connected to its closest neighborby an edge. However, to avoid an infinite loop in certain configurations, where a new vertex causesthe elimination of a previously inserted edge [Ruppert, 1992], protecting spheres centered on thevertices of the edges are used.

This process is repeatedly executed for each sub-segment of a missing edge, and in the end,the edge is recovered, maybe as a collection of triangulation edges.

3.3 Face Recovery

Face recovery implies checking which constrained faces are missing from the triangulation ofthe model convex hull, and forcing its appearance into the final triangulation. This process is morecomplex than edge recovery, mainly because even if all edges on the boundary of a missing faceare present in the triangulation, the face itself maybe missing.

Hazlewood [Hazlewood, 1993] has shown it is possible to produce constrained triangulations,by just re-triangulating tetrahedra, which are intersected by a missing polygonal face. First, allintersection points between a missing polygonal face and the edges of the triangulation are found.Then, all intersected tetrahedra are locally re-triangulated. Since all constrained edges have beenalready recovered, the local triangulation can be performed through the use of the operators de-scribed by Weatherill and Hassan [Weatherill and Hassan, 1994].

These operators deal with the cases where the face completely intersects a tetrahedron, whichis divided into a set of new polyhedra. The new polyhedra can be tetrahedra, pyramids with quadri-lateral bases, or prisms with two triangular and three quadrilateral faces.

Since each tetrahedron is processed separately, it is not possible to assure that all intersectedtetrahedra will be re-triangulated consistently by these operators. The reason is that a prism mayhave all of its quadrilateral faces already triangulated by its adjacent tetrahedra. This problem issolved by inserting a new point in the interior of the prism, and connecting this new point to theedges on the prism.

3.4 Re-triangulation Operators

Tetrahedron-Tetrahedron Triangulation

In this case, only one edge of a tetrahedron intersects the missing face. Therefore, a vertex isinserted in the intersection point between the edge and the face, thus splitting the tetrahedron intwo new tetrahedra sharing the face. (Figure 11).

CILAMCE 2013Proceedings of the XXXIV Iberian Latin-American Congress on Computational Methods in EngineeringZ.J.G.N Del Prado (Editor), ABMEC, Pirenopolis, GO, Brazil, November 10-13, 2013

P. R. Cavalcanti, Y. P. Atencio, C. Esperanca, F. P. Nascimento

Figure 11: Tet-Tet. Figure 12: Tet-Pyramid.

Tetrahedron-Pyramid Triangulation

In this case, two edges of a tetrahedron intersect the missing face. Therefore, two verticesare inserted on the intersection points between the two edges and the face, thus splitting the tetra-hedron in a new tetrahedron and a pyramid sharing the face. The pyramid is also re-triangulatedconforming to its neighborhood (Figure 12).

Tetrahedron-Prism Triangulation

In this case, three edges of a tetrahedron intersect the missing face. Therefore, three verticesare inserted on the intersection points between these three edges and the face, thus splitting thetetrahedron into a new tetrahedron and a prism, sharing the face. In this particular case, the prismcan be re-triangulated based on its neighborhood (Figure 13), or not. Nonetheless, a new vertexcan always be inserted into the prism in such a way it can be re-triangulated conforming to itsneighborhood (Figure 14).

Figure 13: Tet-Prism. Figure 14: Point insertion.

Prism-Prism Triangulation

In this case, four edges of a tetrahedron intersect the missing face. Therefore, four vertices areinserted on the intersection points between the edges and the face, thus splitting the tetrahedron

CILAMCE 2013Proceedings of the XXXIV Iberian Latin-American Congress on Computational Methods in Engineering

Z.J.G.N Del Prado (Editor), ABMEC, Pirenopolis, GO, Brazil, November 10-13, 2013

Multi-Domain Constrained Triangulations Using Off-the-shelf Libraries

into two prisms, sharing the face. The prisms have at least one degree of freedom, because of thecommon face (its diagonal can be chosen arbitrarily). This condition may allow the re-triangulationof both prisms, conforming to their neighborhoods, or not. (Figure 15). If a prism cannot be re-triangulated, a new vertex can always be inserted into it, so it can be re-triangulated conforming toits neighborhood (Figure 16).

Figure 15: Prism-Prism. Figure 16: Point insertion.

3.5 Simplex Classification

After all faces have been recovered, there is a constrained triangulation of the model convexhull. At this point, the triangulation has to be carved by removing all tetrahedra into the convexhull, but outside the model. The carving involves traversing all external tetrahedra (outside thetriangulation domain) and checking whether its faces are marked. By definition, an external tetra-hedron is one that does not possess any face-adjacent tetrahedron in the triangulation. If there isany marked face F in an external tetrahedron A, which does not possess an adjacent tetrahedronB, then tetrahedron A should be kept in the triangulation. Otherwise, tetrahedron A should beremoved and all its adjacent tetrahedra which were not checked yet, should be considered externaltetrahedra. This procedure ends when all external tetrahedra have been evaluated and removed.

After the carving, each simplex in the mesh should be classified to have its attributes set[Cavalcanti et al., 1997, Mello and Cavalcanti, 1999], according to the properties corresponding tothe regions in a multi-region model. For this purpose, it is necessary to keep the data structurerepresenting the input model updated during all the triangulation process, as new vertices, edgesand faces are created in the phases of edge and face recovery. As a consequence, the triangulationfaces on the surfaces of the model are always known. These faces can be used to set boundaryconditions for running simulations.

The simplex classification involves a point in region testing for a tetrahedron, to determine theregion it is into, which can be used as a seed to a flood-fill algorithm. By using the mesh adjacencyinformation, all tetrahedra in a region can be determined and marked during a recursive traversal,which stops when no unmarked tetrahedron can be reached without crossing the boundary of theregion.

CILAMCE 2013Proceedings of the XXXIV Iberian Latin-American Congress on Computational Methods in EngineeringZ.J.G.N Del Prado (Editor), ABMEC, Pirenopolis, GO, Brazil, November 10-13, 2013

P. R. Cavalcanti, Y. P. Atencio, C. Esperanca, F. P. Nascimento

4 Mesh Improvement

After the mesh generation, heuristic methods are commonly used to improve the quality of themesh, (in fact, the quality of its tetrahedra). The quality of a tetrahedron is generally expressed by anumber, which estimates its effect (positive or negative) on the interpolation error, the discretizationerror, and on the stiffness matrix conditioning. The mesh quality is strongly influenced by its worstelements, that is, the worst tetrahedra have more influence than the average tetrahedra.

A sliver is a tetrahedron whose four vertices are very close to a plane, and whose perpendic-ular projection onto this plane is a convex quadrilateral without a short edge. Slivers are alwaysundesirable in tetrahedral meshes, which were generated for being used in applications of the FiniteElement Method. Even when the set of points is well distributed in space, slivers may show up in3D Delaunay triangulations. Therefore, sliver removal algorithms are always applied during themesh generation process.

There are two main methods for mesh improvement: smoothing and topological transforma-tions. Smoothing based methods move some vertices to improve the shape of the incident tetrahe-dra, and they do not change the mesh topology (connectivity). Topological transformations, on theother hand, remove tetrahedra from the mesh and replace them by a new set of tetrahedra that fillthe same space. As a consequence, the topology of the mesh can be changed.

Smoothing methods belong to the numerical optimization domain, while topological trans-formations belong to the combinatorial optimization domain. Both techniques are more effectivewhen applied together.

Smoothing and topological transformations are used by hill-climbing methods to optimize thequality of a mesh. A special function maps each mesh onto a set of values, which describe themesh. Hill-climbing methods evaluate the application of a certain operation in an specific regionof the triangulation. If the quality of the modified mesh is greater than the quality of the originalmesh, then the operation is effectively applied to the mesh, and the hill-climbing method looks foranother operation, which improves the quality of the new mesh. Operations that do not improvethe objective-function value are not applied to the mesh. Therefore, the final mesh cannot be worsethan the original mesh. The hill-climbing method ends when no operation is able to produce anyfurther improvement.

Freitag and Ollivier-Gooch [Freitag and Olliver-Gooch, 1997] presented a hill-climbingmethod that combines smoothing, based on optimization, and an operation called edge removal,with several topological transformations, which encompass operations that modify the connectivityof the mesh, while preserving its volume. New tetrahedra replace some tetrahedra of the mesh,which occupy the same space. In this phase of the mesh generation process, this is done in such away that the quality of the mesh is improved by means of tetrahedra replacement. Should the newtetrahedra have a lower quality compared to the tetrahedra to be replaced, then the operation is notperformed. The following topological transformations are implemented: flip 2-3, flip 3-2 and flip4-4 [Joe, 1991].

They also describe the performance of several different scheduling strategies on a set ofmeshes. It should be noted that scheduling refers either to the order and number of operations

CILAMCE 2013Proceedings of the XXXIV Iberian Latin-American Congress on Computational Methods in Engineering

Z.J.G.N Del Prado (Editor), ABMEC, Pirenopolis, GO, Brazil, November 10-13, 2013

Multi-Domain Constrained Triangulations Using Off-the-shelf Libraries

or the criteria for selecting the tetrahedra that should be improved. They also show that their bestscheduling remove most of the badly shaped tetrahedra, and offer some empiric recommendationsabout what makes a scheduling better than another.

Klingner and Shewchuk [Klingner and Shewchuk, 2007] propose some new topological oper-ations, beyond the smoothing applied to vertices on the boundary, to empower the repertoire ofoperations of the hill-climbing method. They also presented a new scheduling that employs thesenew operations, and show that, by applying all operations together, a better result is produced thanapplying them separately. Even taking speed into account, they make an analysis of the opera-tions with greater impact on the mesh improvement, either individually or combined with otheroperations.

4.1 Smoothing

The most famous smoothing technique is the Laplacian smoothing [Hermann, 1976], whichmoves a vertex to the centroid of the vertices it is connected to. Typically, the Laplacian smoothingapplies several smoothing steps to each vertex in sequence, where each step moves just one vertexat a time. The Laplacian smoothing, although popular and effective on bidimensional meshes, mayproduce a high number of bad tetrahedra on tridimensional meshes.

Freitag et al. [Freitag et al., 1999] proposed a smoothing algorithm to optimize the worst tetra-hedron in the set. In practice, this algorithm maximizes the smaller angle among all of the tetra-hedra incident on a given vertex. This smoothing is applied only to vertices inside the mesh, thatis, vertices on the boundary of the mesh are not smoothed. However, Klingner and Shewchuk[Klingner and Shewchuk, 2007] have extended this smoothing to vertices on the boundary of themesh. In this case, it is necessary that the faces on the boundary of the mesh incident on a vertexlie within a small distance of a given plane. This way, these vertices can be smoothed along thisplane.

The smoothing technique chosen in this work is known as smart smoothing[Freitag and Olliver-Gooch, 1997]. Should a smoothing operation compromise the qualityof the corresponding tetrahedra, then the operation is not applied. Therefore, the quality of themesh never gets worse because of the smoothing.

4.2 Sliver Removal

Cavendish et al. [Cavendish et al., 1985] have shown how the presence of slivers is prejudicialto tridimensional triangulations. Sliver removal is not a simple task. Furthermore, even Delau-nay triangulations generated from well distributed points can contain slivers, as noted by Talmor[Talmor, 1997].

The first positive result in sliver removal was obtained by Chew [Chew, 1997], who adds newpoints to obtain a uniformly dense mesh. Cheng et al. [Cheng et al., 1999] have shown how tospecify weights to the points, during the creation of a weighted Delaunay triangulation, in such away that slivers do not appear. This method does not add new points. Unfortunately, though, itis not completely effective for an arbitrary model. Edelsbrunner et al. [Edelsbrunner et al., 2000]

CILAMCE 2013Proceedings of the XXXIV Iberian Latin-American Congress on Computational Methods in EngineeringZ.J.G.N Del Prado (Editor), ABMEC, Pirenopolis, GO, Brazil, November 10-13, 2013

P. R. Cavalcanti, Y. P. Atencio, C. Esperanca, F. P. Nascimento

propose some mesh improvement techniques to be applied in a post-processing phase to removeslivers, mainly using smoothing operations.

In the mesh generator implemented in this work, some operations to remove slivers in sev-eral phases along the process have been implemented. However, certain operations can only beperformed after recovering the missing faces, since these operations do not honor, globally, theDelaunay criterion. The sliver removal operations include: vertex smoothing, flip 2-3, flip 3-2 andflip 4-4. After the phase of simplex classification, where tetrahedra outside the model are removed,a new sliver removal operation is possible: sliver peel off.

This operation detects slivers with a face on the boundary of the triangulation, and simplyremoves them. The four vertices of a sliver are almost co-planar, which means its volume canbe considered null. Therefore, the peel off operation will not introduce any change inside thetriangulation, because the corresponding tetrahedra are on the boundary.

5 Meshing Strategy

The success of the Finite Element Method depends on the shape of the tetrahedra in the mesh.Large dihedral angles (near 180 degrees) cause severe interpolation errors and reduce the preci-sion of numerical simulations [Krızek, 1992, Shewchuk, 2002]. On the other hand, small dihedralangles cause stiffness matrices, associated to the Finite Element Method, to be ill-conditioned[Shewchuk, 2002]. In some cases, a few bad tetrahedra can ruin a whole simulation.

For a typical model, the constrained Delaunay triangulation generated may have a huge amountof undesired badly shaped tetrahedra. To cope with this issue, a very common approach is justadding points into the model bounding box, positioned at vertices of a regular grid. Nonetheless,this grid may cause the generation of an elevated number of tetrahedra. As a consequence, theappropriate approach is using an adaptive grid [Klingner and Shewchuk, 2007], thus allowing thegeneration of regular tetrahedra (good quality) into the model. During the phase of the generation ofthe Delaunay triangulation, the points of the grid are inserted, according to the Delaunay criterion,in the same way as the points of the model.

The quality of a tetrahedron can be accessed by a single numerical value, called thequality measurement. There are several ways of determining this quality measurement[Klingner and Shewchuk, 2007, Shewchuk, 2002], and we chose the least value of the sine,between the six dihedral angles of a tetrahedron, also known as the smallest sine measure-ment. This measurement penalizes either large or small angles, and Freitag and Ollivier-Gooch[Freitag and Olliver-Gooch, 1997] consider it the most effective among all tested measurement cri-teria.

Klingner and Shewchuk [Klingner and Shewchuk, 2007] employ a hill-climbing method thatprocesses all of the tetrahedra in the mesh, so the worst tetrahedra in the resulting mesh are asgood as possible. Although giving excellent results with respect to the quality of tetrahedra, itsrunning time is very high. Therefore, since badly shaped tetrahedra have a higher influence thanaverage shaped tetrahedra, the hill-climbing method used in this work will process only badly

CILAMCE 2013Proceedings of the XXXIV Iberian Latin-American Congress on Computational Methods in Engineering

Z.J.G.N Del Prado (Editor), ABMEC, Pirenopolis, GO, Brazil, November 10-13, 2013

Multi-Domain Constrained Triangulations Using Off-the-shelf Libraries

shaped tetrahedra. A tetrahedron is considered bad if its dihedral angles, minimum and maximum,are outside a pre-defined range, defined in the method implementation.

Operations, such as smoothing, flip 2-3, flip 3-2 and flip 4-4, are also employed in our hill-climbing method. We also use the point insertion scheme [Klingner and Shewchuk, 2007].

5.1 Point Insertion

This operation computes a position in a bad shaped tetrahedron, and then tries to insert a pointat this position. As a consequence, the best possible set of tetrahedra to be removed from thetriangulation needs to be calculated. This set of tetrahedra is called a cavity. The triangulation isseen as a visibility graph, relative to the position of the inserted point, and the cavity computationis performed as a search in this graph.

The triangulation is reconstructed by connecting the inserted point to the faces on the boundaryof the cavity, followed by a smoothing of the new vertex. If the quality of new tetrahedra is superiorto the quality of the tetrahedra previously in the cavity, then the operation is executed. Otherwise,the mesh remains the same.

It is possible that a vertex is removed from the mesh, if all tetrahedra incident to it are part ofthe cavity. Therefore, sometimes this operation reduces the number of vertices in the mesh.

5.2 Scheduling

Scheduling encompasses the order and number of operations to be executed by the hill-climbing method, and also defines on which set of tetrahedra the operations are going to be per-formed. In general, the scheduling is performed in steps, which apply a set of operations on all ofthe selected tetrahedra. The scheduling schemes described in the literature are heuristic, and havebeen developed by means of trial and error. However, they offer valuable clues based on practicaltests.

Joe’s algorithm [Joe, 1995] visits each face and checks whether any transformation from itsrepertoire can improve, locally, a set of tetrahedra. The algorithm checks all faces and ends when astep does not cause any improvement in the mesh.

The scheduling of Freitag and Ollivier-Gooch [Freitag and Olliver-Gooch, 1997] starts withtwo steps of flips 2-3, followed by a step of edge removal and two steps of smoothing on alltetrahedra of the mesh. Then, it executes a step of flip 2-3 and a face removal operation only on theworst tetrahedra of the mesh. This scheduling ends with two steps of smoothing on all vertices ofthe mesh.

Klingner and Shewchuk [Klingner and Shewchuk, 2007] developed a scheduling without afixed number of steps. They begin with a smoothing step on all vertices and a topological transfor-mation without point insertion. All transformations try edge removal first and then face removal.The scheduling proceeds with a loop to smooth all vertices. If the smoothing is not able to improvethe mesh quality, then topological transformations are tried. If no improvement is achieved, thenpoint insertion is executed. Every time one of these operations improves the quality of the mesh,

CILAMCE 2013Proceedings of the XXXIV Iberian Latin-American Congress on Computational Methods in EngineeringZ.J.G.N Del Prado (Editor), ABMEC, Pirenopolis, GO, Brazil, November 10-13, 2013

P. R. Cavalcanti, Y. P. Atencio, C. Esperanca, F. P. Nascimento

the loop is reset. The scheduling ends when three consecutive steps of the loop are not able to im-prove the quality of the mesh. Their scheduling offers very good results, for improving the qualityof the mesh. However, the run time of the method is high.

In this work, the running time for improving the mesh is an important requirement. Therefore,the scheduling chosen tries to balance the running time of the mesh improvement algorithm and thequality of tetrahedra in the triangulation.

The goal of the improvement process implemented is not to obtain a mesh whose worst tetra-hedra are as good as possible. Rather, the goal is to reduce the number of bad tetrahedra.

The scheduling mechanism has the effect of traversing all of the mesh, always improving itstetrahedra, even those acceptable from the point of view of the Finite Element Method. Since badtetrahedra are really undesirable, the improvement operations, inside the loop, are performed onlyon them.

Our scheduling algorithm starts with a smoothing step applied on all vertices inside the mesh.Then, it performs a loop that tries to improve a bad tetrahedron at a time. The order in which theoperations are executed, in the loop, is the following: vertex smoothing, flip 3-2, flip 4-4, flip 2-3and point insertion. This way, the performance of the scheduling is not a critical factor, as long asthe quality of the mesh is not prejudicial to the Finite Element Method.

Table 1 depicts the number of vertices, tetrahedra, bad elements (before and after mesh opti-mization), and the run time (for generating and improving the mesh), corresponding to the modelsin Figures 17, ... 21. Those figures also present the histogram of minimum dihedral angles, beforeand after optimizing the mesh.

Figure 17: Chinese Dragon. Figure 18: Fan Disk.

6 Conclusion and Future Work

Among all the endeavors in the world, oil exploitation is ranked as one of the riskiest andmore expensive ventures ever. The drilling of a pioneer well may cost up to 100 million dollars indeep water, and the success rate, in an unknown area, is less than 10%. The modeling of complexstructures has been a barrier and a challenge for the development of accurate numerical simulations,necessary for example, to assess the risk in the oil industry.

CILAMCE 2013Proceedings of the XXXIV Iberian Latin-American Congress on Computational Methods in Engineering

Z.J.G.N Del Prado (Editor), ABMEC, Pirenopolis, GO, Brazil, November 10-13, 2013

Multi-Domain Constrained Triangulations Using Off-the-shelf Libraries

Figure 19: Dragon.

Figure 20: Synthetic. Figure 21: Salt.

The main goal of this work was to obtain a robust implementation of a constrained meshgenerator, by using only open, freely available software. The models to be triangulated can be ofany nature and complexity, and the final mesh can be refined to improve the quality of its tetrahedra.

One the main contributions of the paper was allowing the direct input of complex models usingthe CGAL library, by creating a scheme to break the model into fragments, thus overcoming CGALlimitations and allowing the input of complex, multi-region domains. We also combined severalscheduling mechanisms available in the literature, in order to produce a mesh in a reasonable timeand with a small number of bad elements.

The mesh generator has been implemented with portability as a requirement, and it runs eitheron 32 or 64 bit operating systems, such as Linux, Mac OS and Windows, using the same sourcecode. The code is object oriented and was written in C++.

The next steps we intent to perform in the follow up of this work can be summarized as follows:

1. Implementation of local and adaptive refining methods.

2. Use of faster scheduling algorithms.

3. Creation of better sliver removal algorithms.

CILAMCE 2013Proceedings of the XXXIV Iberian Latin-American Congress on Computational Methods in EngineeringZ.J.G.N Del Prado (Editor), ABMEC, Pirenopolis, GO, Brazil, November 10-13, 2013

Table 1: Some mesh statistics generated with our methodology.

Model Vtx Tet Bad tet Bad tet Time Time

before after (generation) (improvement)

Chinese Dragon 303421 1198975 17672 858 982s 129s

Fan Disk 36013 166474 520 12 102s 10s

Dragon 93444 358303 3768 146 435s 32s

Salt 147242 818903 1697 14 5981s 563s

Synthetic 131801 693492 425 0 3745s 279s

Gulf 940257 5136914 267450 70648 10698s 4965s

4. Evaluation of the impact of employing exact versus inexact kernels in CGAL.

5. Generation and processing of huge meshes, with hundreds of millions tetrahedra.

REFERENCES

[Barth and Jesperson, 1989] Barth, T. and Jesperson, D. (1989). The design and application ofupwind schemes on unstructured meshes. In Proceedings of the 27th AIAA Aerospace SciencesMeeting, Reno, Nevada.

[Cavalcanti et al., 1997] Cavalcanti, P. R., Carvalho, P. C., and Martha, L. F. (1997). Nonmanifoldmodeling: An approach based on spatial subdivisions. Computer-Aided Design, 29(3):209–220.

[Cavalcanti and Mello, 1999] Cavalcanti, P. R. and Mello, U. T. (1999). Three-dimensional con-strained Delaunay triangulation: a minimalist approach. In Proceedings of the 8th InternationalMeshing Roundtable, pages 119–129, Lake Tahoe, CA. Sandia National Laboratories.

[Cavendish et al., 1985] Cavendish, J. C., Field, D. A., and Frey, W. H. (1985). An approach toautomatic three-dimensional finite element mesh generation. Int. J. Numer. Meth. Eng., 21:329–347.

[Cheng et al., 1999] Cheng, S.-W., Dey, T. K., Edelsbrunner, H., Facello, M. A., and Teng, S.-H. (1999). Sliver exudation. In SCG ’99: Proceedings of the fifteenth annual symposium onComputational geometry, pages 1–13, New York, NY, USA. ACM.

17

Multi-Domain Constrained Triangulations Using Off-the-shelf Libraries

[Cheng et al., 2012] Cheng, S.-W., Dey, T. K., and Shewchuk, J. R. (2012). Delaunay Mesh Gen-eration. Chapman & Hall/CRC, New York.

[Chew, 1997] Chew, L. P. (1997). Guaranteed-quality delaunay meshing in 3d (short version). InSCG ’97: Proceedings of the thirteenth annual symposium on Computational geometry, pages391–393, New York, NY, USA. ACM.

[Edelsbrunner et al., 2000] Edelsbrunner, H., Li, X.-Y., Miller, G., Stathopoulos, A., Talmor, D.,Teng, S.-H., Ungor, A., and Walkington, N. (2000). Smoothing and cleaning up slivers. In STOC’00: Proceedings of the thirty-second annual ACM symposium on Theory of computing, pages273–277, New York, NY, USA. ACM.

[Freitag et al., 1999] Freitag, L., Jones, M., and Plassmann, P. (1999). A parallel algorithm formesh smoothing. SIAM J. Sci. Comput., 20(6):2023–2040.

[Freitag and Olliver-Gooch, 1997] Freitag, L. and Olliver-Gooch, C. (1997). Tetrahedral meshimprovement using face swapping and smoothing. International Journal for Numerical Methodsin Engineering, 40:3979–4002.

[George and Frey, 2008] George, P.-L. and Frey, S. (2008). Mesh Generation. John Willey & Sons,Inc., New Jersey.

[Hazlewood, 1993] Hazlewood, C. (1993). Approximating constrained tetrahedralizations. Com-puter Aided Geometric Design, 10:67–87.

[Hermann, 1976] Hermann, L. R. (1976). Laplacian-isoparametric grid generation scheme. J. ofthe Eng. Mechanics Div. of the American Soc. of Civil Engineers, 102:749–756.

[Joe, 1989] Joe, B. (1989). Three-dimensional triangulations from local transformations. SIAM J.Sci. Stat. Comput., 10(4):718–741.

[Joe, 1991] Joe, B. (1991). Construction of three-dimensional Delaunay triangulations using localtransformation. Computer Aided Geometric Design, 8:123–142.

[Joe, 1995] Joe, B. (1995). Construction of three-dimensional improved-quality triangulations us-ing local transformations. SIAM Journal on Scientific Computing, 16(6):1292–1307.

[Klingner and Shewchuk, 2007] Klingner, B. M. and Shewchuk, J. R. (2007). Agressive tetrahe-dral mesh improvement. In Proceedings of the 16th International Meshing Roundtable, pages3–23.

[Krızek, 1992] Krızek, M. (1992). On the maximum angle condition for linear tetrahedral ele-ments. SIAM J. Numer. Anal., 29(2):513–520.

[Levy and Lessman, 1992] Levy, H. and Lessman, F. (1992). Finite Difference Equations. Dover.

[Lohner, 1988] Lohner, R. (1988). Generation of three-dimensional unstructured grids by the ad-vancing front method. In Proceedings of the 26th AIAA Aerospace Sciences Meeting, Reno,Nevada.

[Lohner, 1996] Lohner, R. (1996). Progress in grid generation via the advancing front technique.Engineering with Computers, 12:186–210.

CILAMCE 2013Proceedings of the XXXIV Iberian Latin-American Congress on Computational Methods in EngineeringZ.J.G.N Del Prado (Editor), ABMEC, Pirenopolis, GO, Brazil, November 10-13, 2013

P. R. Cavalcanti, Y. P. Atencio, C. Esperanca, F. P. Nascimento

[Mavriplis, 1992] Mavriplis, D. J. (1992). An advancing front Delaunay triangulation algorithmdesigned for robustness. Technical report 92-49, ICASE.

[Mello and Cavalcanti, 1999] Mello, U. T. and Cavalcanti, P. R. (1999). A topologically-basedframework for simulating complex geological processes. In Proceedings of the AAPG Hed-berg Conference-Basin Modeling, Colorado Springs, CO. American Association of PetroleumGeologists.

[Mello and Cavalcanti, 2000] Mello, U. T. and Cavalcanti, P. R. (2000). A point creation strategyfor mesh generation using crystal lattices as templates. In Proceedings of the 9th InternationalMeshing Roundtable, pages 253–261, New Orleans, LA. Sandia National Laboratories.

[Owen, 1998] Owen, S. (1998). A survey of unstructured mesh generation technology. In Proceed-ings of the Seventh International Meshing Roundtable, Dearborn, Michigan. Sandia NationalLaboratories.

[Ruppert, 1992] Ruppert, J. (1992). Results on Triangulation and High Quality Mesh Generation.PhD thesis, Department of Computer Science, University of California at Berkeley, Berkeley,CA.

[Saxena et al., 1995] Saxena, M., Finnigan, P., Graichen, C., Hathaway, A., and Parthasarathy, V.(1995). Octree-based automatic mesh generation for non-manifold domains. Engineering withComputers, 11(1):1–14.

[Schroeder and Shephard, 1990] Schroeder, W. J. and Shephard, M. S. (1990). A combined oc-tree/Delaunay method for fully automatic 3-d mesh generation. International Journal for Nu-merical Methods in Engineering, 29:37–55.

[Shephard and Georges, 1991] Shephard, M. S. and Georges, M. K. (1991). Automatic three-dimensional mesh generation by the finite octree technique. International Journal for NumericalMethods in Engineering, 32:709–749.

[Shewchuk, 1997] Shewchuk, J. R. (1997). Delaunay Refinement Mesh Generation. PhD thesis,Department of Computer Science, Carnegie Mellon University, Pittsburgh, PA.

[Shewchuk, 2002] Shewchuk, J. R. (2002). What is a good linear element? interpolation, condi-tioning, and quality measures. In In 11th International Meshing Roundtable, pages 115–126.

[Stocco and Schrack, 1995] Stocco, L. and Schrack, G. (1995). Integer dilation and contraction forquadtrees and octrees. In Proceedings of the IEEE Pacific Rim Conference on Communications,Computers, and Signal Processing, pages 426–428.

[Talmor, 1997] Talmor, D. (1997). Well-Spaced Points for Numerical Methods. PhD thesis,Carnegie Mellon University, Pittsburgh. CMU CS Tech Report CMU-CS-97-164.

[Watson, 1981] Watson, D. F. (1981). Computing the n-dimensional Delaunay tesselation withapplication to Voronoi polytopes. The Computer Journal, 24(2):167–172.

[Weatherill, 1992] Weatherill, N. P. (1992). Delaunay triangulation in computational fluid dynam-ics. Computers and Mathematics with Applications, 24(5/6):129–150.

CILAMCE 2013Proceedings of the XXXIV Iberian Latin-American Congress on Computational Methods in Engineering

Z.J.G.N Del Prado (Editor), ABMEC, Pirenopolis, GO, Brazil, November 10-13, 2013

Multi-Domain Constrained Triangulations Using Off-the-shelf Libraries

[Weatherill and Hassan, 1994] Weatherill, N. P. and Hassan, O. (1994). Efficient three-dimensional Delaunay triangulation with automatic point creation and imposed boundary con-straints. International Journal for Numerical Methods in Engineering, 37:2005–2039.

[Zienkiewicz et al., 2005] Zienkiewicz, O., Taylor, R., and Zhu, J. (2005). The Finite ElementMethod: Its Basis and Fundamentals (Sixth ed.). Butterworth-Heinemann.

CILAMCE 2013Proceedings of the XXXIV Iberian Latin-American Congress on Computational Methods in EngineeringZ.J.G.N Del Prado (Editor), ABMEC, Pirenopolis, GO, Brazil, November 10-13, 2013