8.6 s

Mesh generation

4.5 μs
  • Regard boundary value problems for PDEs in a finite domain ΩRd

  • Solution spaces for PDEs are infinite dimensional develop finite dimensional approximations

  • One way of defining such approximations is based on the subdivision of Ω into a finite number of elementary closed subsets T1TM, called mesh or grid

  • Elementary shapes:

    • triangles or quadrilaterals (d=2)

    • tetrahedra or cuboids (d=3)

    • more general cases possible

  • During this course:

    • Assume the domain is polygonal, its boundary Ω is the union of a finite number of subsets of hyperplanes in Rn (line segments for d=2, planar polygons for d=3)

    • Focus on simplexes (triangles, tetrahedra)

      • Geometrically most flexible

      • Starting point for more general methods

    • Focus on d=2

3.4 ms

Admissible grids

Definiton: A grid {T1TM} of Ω is admissible if

  • Ω is the union of the elementary cells: Ω¯=m=1MTm

  • If TmTn consists of exactly one point, then this point is a common vertex of Tm and Tn.

  • If for mn, TmTn consists of more than one point, then TmTn is a common edge (or a common facet for d=3) of Tm and Tn.

Image (Source: Braess): Left - admissible mesh, right - mesh with "hanging" nodes

  • There are generalizations of finite element and finite volume methods which can work with hanging nodes, however we will not go into these details in the course.

11.9 μs

Voronoi diagram

After G. F. Voronoi, 1868-1908

Definition: Let p,qRd. The set of points Hpq={xRd:||xp||||xq||} is the half space of points x closer to p than to q.

Definition: Given a finite set of points SRd, the Voronoi region (Voronoi cell) of a point pS is the set of points x closer to p than to any other point qS: Vp={xRd:||xp||||xq||qS}

The Voronoi diagram of S is the collection of the Voronoi regions of the points of S.

11.9 μs
  • The Voronoi diagram subdivides the whole space into ``nearest neigbor'' regions

  • Being intersections of half planes, the Voronoi regions are convex sets

4.6 μs
20.9 ms
414 ms

Delaunay triangulation

After B.N. Delaunay (Delone), 1890-1980

  • Given a finite set of points SRd

  • Assume that the points of S are in general position, i.e. no d+2 points of S are on one sphere (in 2D: no 4 points on one circle)

    • Connect each pair of points whose Voronoi regions share a common edge with a line Delaunay triangulation of the convex hull of S

8.4 μs
9.8 ms
94.1 ms

Another Interactive example via GEOGRAM. This smoothes the point set after insertion, but you get a good impression about the Duality between Voronoi and Delaunay.

3.5 μs
  • The circumsphere (circumcircle in 2D) of a d-dimensional simplex is the unique sphere containing all vertices of the simplex

  • The circumball (circumdisc in 2D) of a simplex is the unique (open) ball which has the circumsphere of the simplex as boundary

Definition: A triangulation of the convex hull of a point set S has the Delaunay property if each simplex (triangle) of the triangulation is Delaunay, i.e. its circumsphere (circumcircle) is empty wrt. S, i.e. it does not contain any points of S.

  • The Delaunay triangulation of a point set S, where all points are in general position is unique and has the Delaunay property

  • Otherwise there is an ambiguity - if e.g. 4 points are one circle, there are two ways to connect them resulting in Delaunay triangles

15.6 μs

Edge flips and locally Delaunay edges (2D only)

  • For any two triangles abc and adb sharing a common edge ab, there is the edge flip operation which reconnects the points in such a way that two new triangles emerge: adc and cdb.

  • An edge of a triangulation is locally Delaunay if it either belongs to exactly one triangle, or if it belongs to two triangles, and their respective circumdisks do not contain the points opposite wrt. the edge

  • If an edge is locally Delaunay and belongs to two triangles, the sum of the angles opposite to this edge is less or equal to π.

  • If all edges of a triangulation of the convex hull of S are locally Delaunay, then the triangulation is the Delaunay triangulation

  • If an edge is not locally Delaunay and belongs to two triangles, the edge emerging from the corresponding edge flip will be locally Delaunay

8.4 μs

Flip edge to make the triangles Delaunay:

14.2 ms
2.3 s

Lawson's Edge flip algorithm for constructing a Delaunay triangulation

This is one of the most elementary mesh generation algorithms

  • Input: A stack L of edges of a given triangulation of a set S of n points

  • While L

    • pop an edge ab from L

    • If ab is not locally Delaunay

      • Flip ab to cd

      • Push edges ac,cb,db,da onto L

This algorithm is known to terminate after O(n2) operations. After termination, all edges will be locally Delaunay, so the output is the Delaunay triangulation of S.

  • Among all triangulations of a finite point set S, the Delaunay triangulation maximises the minimum angle of all triangles2

  • The set of all possible triangulations of S is connected via the flip graph. Each edge of this graph corresponds to one particular flip operation

11.2 μs

Randomized incremental flip algorithm (2D only)

  • Create Delaunay triangulation of point set S by inserting points one after another, and creating the Delaunay triangulation of the emerging subset of S using the flip algorithm

  • Estimated complexity: O(nlogn)

  • In 3D, there is no simple flip algorithm, generalizations are active research subject

5.6 μs

Open source codes implementing mesh generation

  • CGAL: The Computational Geometry Algorithms Library

  • ND: qhull mostly for pointsets

  • 2D: Triangle by J.R.Shewchuk (UC Berkeley)

  • 3D: TetGen by H. Si (WIAS Berlin)

  • 3D: NetGen by J. Schöberl and coworkers

8.8 μs

Triangle

During this course, we will focus on Triangle. It can be compiled to a standalone executable reading and writing files or to a library which can be called from applications.

In Julia it is accessible via the package Triangulate.jl.

The following examples have been taken from that package and slightly modified for Pluto.

4.6 μs

General use

  • Triangle communicates via a data structure TriangulateIO which contains possible input and output information

  • It processes an input structure and returns on output the triangulation, and possibly, the Voronoi diagram.

  • It is controlled via a string containing switches

  • The switch '-Q' makes Triangle quiet

7.4 μs

Delaunay triangulation of the convex hull of a pointset

Create a set of random points in the plane and calculate the Delaunay triangulation of this set of points. It is a triangulation where for each triangle, the interior of its circumcircle does not contain any points of the trianglation.

The Delaunay triangulation of a set of points in general position (no 4 of them on a circle) is unique. At the same time, it is a triangulation of the convex hull of these points.

Given an input list of points, without any further flags, Triangle creates just this triangulation (the "Q" flag suppresses the text output of Triangle). For this and the next examples, the input list of points is created randomly, but on a raster, preventing the appearance of too close points.

6.5 μs
example_convex_hull (generic function with 1 method)
49.5 μs
247 ms
86.6 ms

Delaunay triangulation of point set with boundary

Same as the previous example, but in addition specify the "c" flag In this case, Triangle outputs an additional list of segments describing the boundary of the convex hull. In fact this is a constrained Delaunay triangulation (CDT) where the boundary segments are the constraining edges which must appear in the output.

3.3 μs
example_convex_hull_with_boundary (generic function with 1 method)
49.6 μs
13.0 ms
234 ms

Delaunay triangulation of point set with Voronoi diagram

Same as the previous example, but instead of "c" specify the "v" flag In this case, Triangle outputs information about the Voronoi diagram of the point set which is a structure dual to the Delaunay triangulation.

The Voronoi cell around a point p a point set S is defined as the set of points x such that |xp|<|xq| for all qS such that pq.

The Voronoi cells of boundary points of the convex hull are of infinite size. The corners of the Voronoi cells are the circumcenters of the triangles. They can be far outside of the triangulated domain.

6.2 μs
example_convex_hull_voronoi (generic function with 1 method)
64.3 μs
152 ms

Boundary conforming Delaunay triangulation of point set

Specify "c" flag for convex hull segments, "v" flag for Voronoi and "D" flag for creating a boundary conforming Delaunay triangulation of the point set. In this case additional points are created which split the boundary segments and ensure that all triangle circumcenters lie within the convex hull. Due to random input, there may be situations where Triangle fails with this task, so we check for the corresponding exception.

3.3 μs
example_convex_hull_voronoi_delaunay (generic function with 1 method)
63.9 μs
111 ms

Constrained Delaunay triangulation (CDT) of a domain given by a segment list specifying its boundary.

Constrained Delaunay triangulation (CDT) of a point set with additional constraints given a priori. This is obtained when specifying the "p" flag and an additional list of segments each described by two points which should become edges of the triangulation. Note that the resulting triangulation is not Delaunay in the sense given above.

3.2 μs
example_domain_cdt (generic function with 1 method)
71.8 μs
119 ms

Constrained Delaunay triangulation (CDT) of a domain given by a segment list specifying its boundary together with a maximum area constraint.

This constraint is specfied as a floating point number given after the -a flag. Be careful to not give it in the exponential format as Triangle would be unable to analyse it. Therefore it is dangerous to give a number in the string interpolation and it is better to convert it to a string before using @sprintf. Specifying only the maximum area constraint does not prevent very thin triangles from occuring at the boundary.

3.4 μs
example_domain_cdt_area (generic function with 1 method)
109 μs
130 ms

Boundary conforming Delaunay triangulation (BCDT) of a domain given by a segment list specifying its boundary

In addition to the area constraint specify the -D flag in order to keep the triangle circumcenters within the domain.

2.9 μs
example_domain_bcdt_area (generic function with 1 method)
130 μs
425 ms

Triangulation of a domain with refinement callback

A maximum area constraint is specified in the unsuitable callback which is activated via the "u" flag if it has been passed before calling triangulate. In addition, the "q" flag allows to specify a minimum angle constraint preventing skinny triangles.

3.2 μs
example_domain_localref (generic function with 1 method)
117 μs
83.8 ms

Triangulation of a heterogeneous domain

The segment list specifies its boundary and the inner boundary between subdomains. An additional region list is specified which provides "region points" in regionlist[1,:] and regionlist[2,:]. These kind of mark the subdomains. regionlist[3,:] contains an attribute which labels the subdomains. regionlist[4,:] contains a maximum area value. size(regionlist,2) is the number of regions.

With the "A" flag, the subdomain labels are spread to all triangles in the corresponding subdomains, becoming available in triangleattributelist[1,:]. With the "a" flag, the area constraints are applied in the corresponding subdomains.

4.2 μs
example_domain_regions (generic function with 1 method)
94.9 μs
281 ms