An Introduction To Automatic Mesh Generation Algorithms
An Introduction To Automatic Mesh Generation Algorithms
An Introduction to Automatic
Mesh Generation Algorithms
Short Course, September 26, 2016
Washington, DC
Steven Owen
Sandia National Laboratories
Sandia National Laboratories is a multi-program laboratory managed and operated by Sandia Corporation, a wholly owned subsidiary of Lockheed Martin
Corporation, for the U.S. Department of Energy’s National Nuclear Security Administration under contract DE-AC04-94AL85000. SAND NO. 2011-XXXXP
1
Agenda
Part I 8:00-9:30AM Part II 10:00-11:30AM
The Simulation Process Tet vs. Hex Meshing
Geometry Basics Structured vs. Unstructured
Mesh Representations Structured Hex Methods
Mesh Generation Methods Unstructured Hex Methods
Tet/Tri Meshing Methods Hex Dual Representations
Surface Meshing Basics Overlay Grid
Smoothing Automatic Block
Decomposition
Hybrid Methods
2
Classical References
J. F. Thompson, B. K. Soni, and N. P. Weatherill, eds.,
Handbook of Grid Generation, CRC Press, 1998.
Block-structured grids:
• Transfinite-interpolation, Elliptic and hyperbolic PDE
systems, Harmonic mappings, ...
• Unstructured grids: Quadtrees and Octrees methods,
• Advancing-front methods, Delaunay-Voronoi methods,
• Anisotropic Grid generation, ...
3
Simulation Process
3 2 kN
4. Computational Analysis
5. Visualization
4
Adaptive Simulation Process
User
supplies meshing
parameters
2
3 2 kN
Adaptivity Loop
6. Remesh/Refine/Improve
4. Computational Analysis 5. Error Estimation
Error <
7. Visualization
5
Geometry
vertices: x,y,z
location
6
Geometry
curves: bounded by
vertices: x,y,z two vertices
location
7
Geometry
8
Geometry
Manifold Geometry:
Each volume maintains
Surface 11
its own set of unique
Volume 1
surfaces
Volume 2
Volume 2
Surface 7
Surface 8 Surface 9 Surface 10 Surface 11
Volume 1
10
Geometry
Non-Manifold
Geometry: Volumes
share matching surfaces
Volume 1
Volume 2
Volume 2
Surface 7
Surface 8 Surface 9 Surface 10
Volume 1
11
Geometry
Geometry Engine
12
Geometry
Triangle Hex
Delaunay
Paving Advancing Sweeping
Tet Mesher
Front Tool
Geometry Engine
13
Geometry
Triangle Hex
Delaunay
Geometry Query Paving Advancing Sweeping
Front
Tet Mesher
Tool
Topology Query
Curve::project_to() Surface::curves()
Surface::project_to() Curve::vertices()
Surface::normal_at() Volume::surfaces()
Surface::curvature_at() Vertex::curves()
Geometry Engine
14
Geometry
Triangle Hex
Delaunay
Geometry Query Paving Advancing Sweeping
Front
Tet Mesher
Tool
Topology Query
Curve::project_to() Surface::curves()
Surface::project_to() Curve::vertices()
Surface::normal_at() Volume::surfaces()
Surface::curvature_at() Vertex::curves()
15
Geometry
Triangle Hex
Delaunay
Geometry Query Paving Advancing Sweeping
Front
Tet Mesher
Tool
Topology Query
Curve::project_to() Surface::curves()
Surface::project_to() Curve::vertices()
Surface::normal_at() Volume::surfaces()
Surface::curvature_at() Vertex::curves()
CAD Abstraction
Open
ACIS Catia Facets
Cascade
16
Mesh Representation
mass quadrilateral
beam
triangle
0D 1D 2D
tetrahedra
wedge
hexahedra pyramid
3D
17
Mesh Representation
Node-Element Virtual Edges Cyclic Connectivity Doubley-Linked
Connectivity Only and/or Faces Connectivity
18
Mesh Representation
Geometry Associativity
Vertex Node
Boundary Conditions applied to
geometric entities.
19
Mesh Generation Methods
Nodes
mesh projected to
surfaces geometry
mesh
vertices
curves
20
Mesh Generation Methods
21
Mesh Generation Methods
• AKA. Bottom-up Meshing • AKA. Overlay Grid
• Advancing Front • Octree Methods
• Delaunay Methods • Grid-based Methods
• Boundary constrained • No Boundary constraints
• Dimension n mesh is input for dimension • Boundary nodes placed based on
n+1 intersection and/or projection
• Incremental Workflow • All-in-one Workflow
• One entity at a time • All geometry at once
• Neighbors conform • Neighbors will not conform
• More control over mesh quality and • Less control over mesh quality and
element placement element placement
• Boundary layers • Orientation of initial mesh w.r.t. geometry
• Directionality effects final mesh
• Structured meshing requires special • No special case topologies for hex
case topologies meshing
• Pave-sweep • No special case decompositions needed
• Block-structured
• Manual/Automated decomposition required
22
Mesh Generation Process
Remove
Smoothing/
exterior
Cleanup
mesh
http://www.ansys.com
25
Tet Meshing Software
A Representative Sample
Commercial
• Tetmesh-GHS3D, INRIA, Rocquencourt, Distene France.
• MeshSim, SCOREC, RPI, Simmetrix Inc. USA.
• SolidMesh, AFLR mesh generator, SimCenter, Mississippi State Uni.,
(Altair Hypermesh)
Open Source
• Netgen, TU Vienna.
• Gmsh, Uni. Liege & Uni. Catholique de Louvain.
• GRUMMP, University of British Columbia.
• Pyramid, UC Berkeley.
• CGALmesh, INRIA, Sophia-Antipolis.
• TetGen, Weierstrass Institute, Berlin.
26
Octree/Quadtree
27
Octree/Quadtree
QMG,
Cornell University
28
Octree/Quadtree
QMG,
Cornell University
29
Advancing Front
A B
•Begin with boundary mesh - define as initial front
•For each edge (face) on front, locate ideal node C based on front AB
30
Advancing Front
C D
r
A B
31
Advancing Front
32
Advancing Front
33
Advancing Front
34
Advancing Front
35
Advancing Front
r
C
A
B
•Where multiple choices are available, use best quality (closest
shape to equilateral)
•Reject any that would intersect existing front
•Reject any inverted triangles (|AB X AC| > 0)
•(Lohner,88;96)(Lo,91)
36
Advancing Front
37
Advancing Front
38
Advancing Front
39
Advancing Front
r
D
40
Advancing Front
r
D
41
Advancing Front
B D
42
Advancing Front
C
D
43
Advancing Front
Ansys, Inc.
www.ansys.com
44
Delaunay
Triangle
Jonathon Shewchuk
http://www-2.cs.cmu.edu/~quake/triangle.html
Tetmesh-GHS3D
INRIA, France
http://www.simulog.fr/tetmesh/
45
Delaunay
circumcircle
Ax By C x 2 y 2 x1 , y1
x3 , y3
x1 y1 1 A x12 y12
x
y2 1 B x22 y22
xc , yc
2 r
x3 y3 1 C x32 y32
A B
xc , yc , r C xc2 yc2
2 2 x2 , y 2
47
47
Delaunay
Delaunay Triangulation:
Obeys empty-circle (sphere) property
48
Delaunay
Delaunay Triangulation:
Obeys empty-circle (sphere) property
49
Delaunay
Delaunay Triangulation:
Obeys empty-circle (sphere) property
50
Delaunay
Vornoi cell
Delaunay Triangulation:
Obeys empty-circle (sphere) property
51
Delaunay
Voronoi Diagram
Dual of a Delaunay Triangulation
52
Delaunay
circumsphere
circumsphere
Given a Delaunay
Triangulation of n nodes, How
do I insert node n+1 ?
X
Lawson Algorithm
•Locate triangle containing X
•Subdivide triangle
•Recursively check adjoining
triangles to ensure empty-circle
property. Swap diagonal if
needed
•(Lawson,77)
55
Delaunay
Lawson Algorithm
•Locate triangle containing X
•Subdivide triangle
•Recursively check adjoining
triangles to ensure empty-circle
property. Swap diagonal if
needed
•(Lawson,77)
56
Delaunay
Bowyer-Watson Algorithm
•Locate triangle that contains
the point
•Search for all triangles whose
X circumcircle contain the point
d (d<r)
r •Delete the triangles (creating
c a void in the mesh)
•Form new triangles from the
new point and the void
boundary
•(Watson,81)
Given a Delaunay
Triangulation of n nodes, How
do I insert node n+1 ?
57
Delaunay
Bowyer-Watson Algorithm
•Locate triangle that contains
the point
•Search for all triangles whose
X circumcircle contain the point
(d<r)
•Delete the triangles (creating
a void in the mesh)
•Form new triangles from the
new point and the void
boundary
•(Watson,81)
Given a Delaunay
Triangulation of n nodes, How
do I insert node n+1 ?
58
Delaunay
59
Delaunay
insert point
X
60
Delaunay
cavity
insert point
X
61
Delaunay
filled cavity
insert point
X
62
Delaunay
63
Delaunay
64
Delaunay
65
Delaunay
66
Delaunay
67
Delaunay
68
Delaunay
•Recover boundary
•Delete outside triangles
•Insert internal nodes
69
Delaunay
Node Insertion Methods
Grid Based
•Nodes introduced based on a regular lattice
•Lattice could be rectangular, triangular, quadtree, etc…
•Outside nodes ignored
70
Delaunay
Node Insertion Methods
Grid Based
•Nodes introduced based on a regular lattice
•Lattice could be rectangular, triangular, quadtree, etc…
•Outside nodes ignored
71
Delaunay
Node Insertion Methods
Advancing Front
•“Front” structure maintained throughout
•Nodes introduced at ideal location from current front edge
(Marcum,95)
74
Delaunay
Node Insertion Methods
Advancing Front
•“Front” structure maintained throughout
•Nodes introduced at ideal location from current front edge
(Marcum,95)
75
Delaunay
Node Insertion Methods
Edges
•Nodes introduced along existing edges at l=h
•Check to ensure nodes on nearby edges are not too close
(George,91)
76
Delaunay
Node Insertion Methods
Edges
•Nodes introduced at along existing edges at l=h
•Check to ensure nodes on nearby edges are not too close
(George,91)
77
Delaunay
Boundary Constrained
Boundary Intersection
•Nodes and edges introduced where Delaunay edges
intersect boundary
78
Delaunay
Boundary Constrained
Boundary Intersection
•Nodes and edges introduced where Delaunay edges
intersect boundary
79
Delaunay
Boundary Constrained
Local Swapping
•Edges swapped between adjacent pairs of triangles until
boundary is maintained
80
Delaunay
Boundary Constrained
Local Swapping
•Edges swapped between adjacent pairs of triangles until
boundary is maintained
81
Delaunay
Boundary Constrained
Local Swapping
•Edges swapped between adjacent pairs of triangles until
boundary is maintained
82
Delaunay
Boundary Constrained
Local Swapping
•Edges swapped between adjacent pairs of triangles until
boundary is maintained
83
Delaunay
Boundary Constrained
Local Swapping
•Edges swapped between adjacent pairs of triangles until
boundary is maintained
(George,91)(Owen,99)
84
Delaunay
D C
VS
Boundary Constrained
85
Delaunay
E3
D C
E5 E4
E8 E2
E6 E1
E7
Boundary Constrained
86
Delaunay
E3 E1
D C
E5 E4
E8 E2
E6
E7
87
Delaunay
E3
D C
E5 E4
E8
E6 E2
E7
E3
D C
E5 E4
E8
E6
E7
D C
E6
D E
A
3D Local Swapping
•Requires both boundary edge recovery and boundary
face recovery
(George,91;99)(Owen,00)
91
Delaunay
Boundary Constrained
Edge Recovery
DE = edge to be recovered
B •Force edges into triangulation by
performing 2-3 swap transformation
D E
2-3 Swap
ABCE
ACBD C ABC = non-conforming face
A
3D Local Swapping
•Requires both boundary edge recovery and boundary
face recovery
(George,91;99)(Owen,00)
92
Delaunay
Boundary Constrained
Edge Recovery
DE = edge recovered
B •Force edges into triangulation by
performing 2-3 swap transformation
D E
2-3 Swap
BAED
ABCE
CBED
ACBD C
ACED
A
3D Local Swapping
•Requires both boundary edge recovery and boundary
face recovery
(George,91;99)(Owen,00)
93
Delaunay
Boundary Constrained
Edge Recovery
DE = edge recovered
B •Force edges into triangulation by
performing 2-3 swap transformation
D E
2-3 Swap
BAED
ABCE
CBED
ACBD C
ECED
A
3D Local Swapping
•Requires both boundary edge recovery and boundary
face recovery
(George,91;99)(Owen,00)
94
Delaunay
Edge AB to be recovered
3D Edge Recovery
•Form queue of faces through which edge AB will pass
•Perform 2-3 swap transformations on all faces in the list
•If overlapping tets result, place back on queue and try again later
•If still cannot recover edge, then insert “steiner” point
95
Delaunay
2-3 Swap 2-2 Swap Face Split Edge Split Edge Suppress
abce, acbd aceb, adcb abce, acbd abnini+1 {i=1…N} abnini+1 {i=1…N}
abde, bcde, cade adeb, edcb abfe, bcfe, cafe abnini+1, nm,knm.jnm.ia,
bafd, cbfd, acfd cbnini+1 {i=1…N} nm,knm.jnm.ib {m=1…M}
N = no. adj. tets at edge ab M = no. unique trias in
polygon P={n1,n2,n3}
96
Surface Meshing
97
Surface Meshing
98
Surface Meshing
NC Tangent plane
A
C
99
Surface Meshing
NC
A
C
D B
100
Surface Meshing
NC
A
C
101
Surface Meshing
102
Surface Meshing
103
Surface Meshing
104
Surface Meshing
u
v
u
Warped parametric space
105
Surface Meshing
106
Surface Meshing
107
Surface Meshing
l ( XQ) XQT M ( X) XQ
v Q
M(X)
X Q u X l ( XQ)
l ( XQ)
v y
x
z
u
108
Surface Meshing
109
Surface Meshing
110
Smoothing
P4
P3
P
P5
P2
P1
(Field, 1988)
Laplacian
111
Smoothing
P4 Centroid of
attached nodes
P3
P
P5
P2 n
Pi
P1
P i 1
(Field, 1988) n
Laplacian
112
Smoothing
Centroid of
P4 attached nodes
Can create
inverted elements
P
P5
P1
P3
n
Pi
P6 P i 1
P2 n
Laplacian
113
Smoothing
Centroid of
P4 attached nodes
Can create
inverted elements
P5
P1
P3
P
n
Pi
P6 P i 1
P2 n
Laplacian
114
Smoothing
Centroid of
P4 attached nodes
Can create
inverted elements
P
Constrained Laplacian: Do not
P5 move node unless minimum
P1 distortion metric is improved
P3
n
Pi
P6 P i 1
P2 n
Laplacian
115
Smoothing
Smoothing Procedure
LET iter=0
SET all NODE v to active
REPEAT (main smoothing loop)
FOR EACH NODE v DO:
1. If v has been deactivated from smooth, then CONINUE.
2. distance moved = move_node(v)
3. If distance moved < move tolerance, then
deactivate v
Else,
Allow move.
If neighbor node to v is inactive, then activate it.
END DO
iter++;
UNTIL all nodes are deactivated OR iter > MAX_ITER (end of main smoothing loop)
116
Smoothing
x
(Canann, Tristano,
i min
Staten, 1998) Pnew P g min
g g g g i
117
Smoothing
Compute shape
Optimization-
min
metric i for each
Based y quad at P
Method min
x Choose min to
optimize
Steepest descent
optimization Compute gradient
vector g=gmin by
y perturbing small
in x and y
x
(Canann, Tristano,
i min
Staten, 1998) Pnew P g min
g g g g i
118
Smoothing
Compute shape
Optimization-
metric i for each
Based quad at P
min
Method y
Choose min to
min
optimize
x
Steepest descent
optimization Compute gradient
vector g=gmin by
y perturbing small
in x and y
x
(Canann, Tristano,
i min
Staten, 1998) Pnew P g min
g g g g i
119
Smoothing
Triangle Distortion Metric
C
NS = Surface normal
area ( ABC )
( ABC ) ( I ) 3 2 2 2
l1 l2 l3
l2
1 for CA CB N S 0
I
l3 1 for CA CB N S 0
B C
C
C
l1 B
A
A B B A
(Canann, Tristano, Staten, 1998) A
=1 =0 =-1
120
Smoothing
C
Quad Distortion Metric
D
Compute four triangle metrics
(ABC ) (CDA)
(BCD ) (DAB )
B Order metrics in descending order
1 2 3 4
A 3 4
1 2
121
Smoothing
Combined Laplacian and Optimization
Based Smoothing
Compute initial distortion metrics for all elements
LET iter=0
SET all NODE v to active
REPEAT (main smoothing loop)
FOR EACH NODE v DO:
1. If v has been deactivated from smooth, then CONINUE.
2. If v wasn’t moved by optimization-based smoothing in last iteration, then
distance_moved = move_node_laplacian(v)
3. If (iter >= 2) then
distance_moved = move_node_optimize(v)
4. If distance_moved < move_tolerance AND min > min_allowable_metric, then
deactivate v
Else,
Allow move, and update adjacent distortion metrics to v.
If neighbor node to v is inactive, then activate it.
END DO
iter++;
UNTIL all nodes are deactivated OR iter > MAX_ITER (end of main smoothing loop)
122