NETGEN - An Advancing Front 2D/3D-Mesh
Generator Based on Abstract Rules
Joachim Schob erl
Abstract
In this paper, the algorithms of the automatic mesh generator NETGEN are describ ed.
The domain is provided by a Constructive Solid Geometry (CSG). The whole task of
3D mesh generation splits into four subproblems of sp ecial p oint calculation, edge
following, surface meshing and nally volume mesh generation. Surface and volume
mesh generation are based on the advancing front metho d. Emphasis is given to
the abstract structure of the element generation rules. Several techniques of mesh
optimization are tested and quality plots are presented.
1 Intro duction
Many engineering disciplines require partial dierential equation (p de) mo deling. Two of
the most popular metho ds to treat p des numerically are the nite element method and the
nite volume metho d. Both require partitioning the domain of interest into a set of simple
domains, the elements. In two dimensions triangles and quadrilaterals are used, in three
dimensions tetrahedra, hexahedra and p entahedra are the most p opular elements. It is
desirable to p erform this partitioning automatically. There are several approaches working
well in the plane, but cause a lot of diculties in three dimensions. Overviews of mesh
generation algorithms are given in [1], [13].
One of the most p opular metho ds is the advancing front technique, see e.g. [10], [14], [9],
[8], [6]. The input to this method is a boundary mesh. Starting with the original b oundary,
element by element is cut o to reduce the domain iteratively. The state of the algorithm
is always represented by the advancing b oundary front. In several papers, rules for element
generation are presented. We want to emphasize, how to handle these rules by means of an
abstract rule description. The advancing front method can b e applied for plane, for surface
as well as for three dimensional mesh generation. Our approach to rule application leads to
a highly unied code for these three kinds of mesh generation.
Advancing front mesh generation starts with a given b oundary mesh. In 3D, b oundary
mesh generation is also a non-trivial task. It can b e solved by an advancing front surface
mesh generator starting at the b oundaries of the smo oth pieces of the surface, namely the
edges. Edge nding can b e split into calculation of initial p oints and implicit curve following.
Dep ending on the geometric mo del, initial p oint calculation can b e complicated, to o. We
use the Constructive Solid Geometry (CSG) - mo del, dening complicated solids by the
Bo olean operations applied to simple primitives [11]. For this mo del we have to solve many
nonlinear equations in three variables to calculate initial p oints for edge detection. The
whole mesh generation problem is sketched in Figure 1.
This work is supported by the Austrian Science Fund - 'Fonds zur Forderung der wissenschaftlichen
Forschung' - under pro ject P 10643-TEC
1
Geometric mo del
?
Nonlinear equations
Sp ecial p oints
?
Curve following
Edges
?
2D mesh generation +
lo cal transformation
Surface mesh
?
3D mesh generation
Volume mesh
Figure 1: Subproblems in mesh generation
The pap er is organized accordingly to the several sub-problems. In
x
2 the geometric
mo del in use is describ ed. The problem of calculating corners and more sp ecial p oints is
describ ed in
x
3, edge detection in
x
4. Our implementation of the advancing front metho d for
plane, surface and volume mesh generation is explained in
x
5. The used mesh optimization
strategies are discussed in
x
6. In
x
7 examples are given and in
x
8 the current work is
summarized.
2 Geometric Mo deling
The wide eld of computational geometry provides several p ossibilities for geometric mod-
eling [11]. The dierent mo dels have complementary prop erties with resp ect to ease of solid
description and ease of mesh generation algorithms.
The Constructive Solid Geometry (CSG) - mo del uses smo oth primitives like cylinders
and spheres to build more complex solids by the Bo olean operations. In the computer, the
solid is represented by a binary tree. The leaves are the primitives, and the no des are the
op erations intersection, union and complement. A lot of mechanical production parts can
b e describ ed by this mo del very simply, but it takes some numerical eort to nd the corners
and edges.
Explicit surface description, e.g. by spline patches, is very well suited for smo oth surfaces
like car b o dies and airplane wings [7]. It is dicult to describ e geometries with cutting
edges, but mesh generation for explicit surfaces can b e much simpler. The exibility of b oth
metho ds can b e combined by using CSG primitives described by spline patches.
To apply mesh generation algorithms for the CSG mo del, some op erations have to b e
implemented for every class of primitives. For globally convergent algorithms to nd the
corners we need the test 'Is a given cub e contained in the primitive ?' The p ossible answers
are 'no', 'partially' and 'yes'. For edge detection as well as surface meshing we need lo cal
quantities like the normal vector to the smo oth b oundary of a primitive.
2
Figure 2: Examples for points of intersection and p oints of extreme co ordinates
3 Sp ecial Point Calculation
The rst step in mesh generation is the calculation of sp ecial p oints. For reasons of numerical
approximation it is imp ortant to place mesh no des at the corners of the geometry. These
'p oints of intersection' are p oints, where at least three surfaces intersect (Figure 2). The
computation of them is explained in
x
3.1.
Starting at these p oints, one can follow the edges. But not every edge is terminated by
two p oints of intersection. E.g., a cylinder has closed edges (Figure 2). To get uniquely
dened p oints on these curves one can cho ose the p oints with minimal or maximal x, y or
z co ordinates. The computation of the 'p oints of extreme co ordinates' is described in
x
3.2.
There are more typ es of sp ecial points arising from some kind of degeneration. These p oints
are discussed in
x
3.3. Together with the sp ecial p oints, tangents to the edges are calculated.
3.1 Points of intersection
Points of intersection are p oints, where at least three surfaces intersect. For implicitly
dened surfaces these are the ro ots of the nonlinear system
f
1
(
x; y ; z
) = 0
;
f
2
(
x; y ; z
) = 0
;
(1)
f
3
(
x; y ; z
) = 0
:
Robust and exible solving pro cedures for this problem are bisection algorithms based on
geometric tests. We start with a cub e containing the whole solid. This cube is cut into eight
cub es of half the size recursively, until a necessary criterion to have a p oint of intersection
in the cub e is not fullled anymore or the prescrib ed precision is reached. A very cheap
criterion is the numb er of surfaces cutting the cub e, which has to b e at least three. The
evolution of a bisection algorithm for a 2D example is given in Figure 3. If the p oint of
intersection is regular, the bisection algorithm converges with linear rate.
3.1.1 Lo calization
The bisection algorithm uses only information of the solid contained in a cub e. If we use a
CSG mo del, the solid can b e reduced to a lo cal mo del in the cub e by a recursive algorithm
on the binary solid tree. The lo cal mo del is
0
, if the cub e is outside of the solid,
S
, if the
cub e is partially contained in the solid, or
1
, if the cube is fully contained in the solid. The
state
S
is describ ed by a smaller CSG model again. A primitive has to provide a function to
determine the relation of a cub e to the solid. For the Bo olean op erations, the lo calization
can be expressed by the lo calization of the op erands:
3
Figure 3: Bisection algorithm
\
0 S
1
1
0 0 0 0
S
2
0 S
1
\
S
2
S
2
1 0 S
1
1
[
0 S
1
1
0 0 S
1
1
S
2
S
2
S
1
[
S
2
1
1 1 1 1
n
0 1
S
n
S
1 0
A minimal numb er of three primitives in the lo cal mo del is used as necessary condition in
the bisection algorithm.
3.1.2 Newton's metho d
Let us assume, we can evaluate the functions
f
i
as well as their derivatives. If we are close
to a ro ot of the nonlinear system (1), we can use the lo cally quadratic convergent Newton
metho d to calculate the coordinates in just a few steps within machine precision [12]. With
F
(
x
) := (
f
1
(
x; y ; z
)
; f
2
(
x; y ; z
)
; f
3
(
x; y ; z
)) and a given initial p oint
x
0
Newton's metho d
is dened by
x
k
+1
=
x
k
?
F
0
x
k
?
1
F
x
k
:
For (1), the geometric interpretation of Newton's metho d is as following. In the limit, the
comp onents of
F
(
x
) measure the distance of
x
to the corresp onding surface, and the columns
of the matrix
F
0
are scalar multiples of the normal vectors of the surfaces. The new p oint
x
k
+1
is the p oint of intersection of the three tangential plains. We need the regularity of
the solution to apply Newton's metho d.
We see, which op erations a primitive has to provide. In a small environment of the
surface, we need a linear approximation to an implicit representation of the surface. For
explicitly given surfaces we can dene an implicit function by
f
(
x
) = (
x
?
P
(
x
)
; n
(
P
(
x
)))
;
(2)
where
P
(
x
) is the pro jection of
x
onto the surface, and
n
is the normal vector to the surface.
The derivative of
f
is
r
f
(
x
) =
n
(
P
(
x
))
:
The non-trivial step for explicit surfaces is the implementation of the pro jection
P
(
x
).
For spline surfaces this pro jection can b e implemented fast and robust by using the convex
hull property and zo om-in algorithms [7].
Before starting Newton's metho d one has to check whether it converges to a unique
solution. This test is given in Kantorovich's theorem [12]:
4
Let
B
(
x
0
; r
) b e a sphere containing the current b ox.
Assume that
F
0
(
x
0
) is regular and the conditions
k
F
0
(
y
)
?
F
0
(
x
)
k
k
y
?
x
k 8
x; y
2
B
(
x
0
; r
)
;
k
F
0
x
0
?
1
k
;
k
F
0
x
0
?
1
F
x
0
k
;
are fullled such that
:=
<
1
2
;
(3)
t
:=
1
1
?
p
1
?
2
< r:
(4)
Then Newton's metho d with initial point
x
0
is well dened and
x
k
converges to
a ro ot of
F
in
B
(
x
0
; t
). The ro ot is unique in
B
(
x
0
; t
) with
t
=
1
1 +
p
1
?
2
:
In a small environment of a regular solution the constants
and
are bounded. By further
sub division we can reduce
until (3) and (4) are fullled and the solution is unique in the
bisection interval.
To implement the convergence test we have to evaluate the constants
,
and
. For
this we need in addition to the implicit function value and its derivative an estimate for the
lo cal Lipschitz - constant
of
r
f
. For the implicit function
f
dened in (2), the b ound can
b e calculated by means of the main curvature
. In the (2
)
?
1
environment of the surface
the Hessian
r
2
f
is b ounded by 2
.
3.2 Points of extreme co ordinates
As mentioned ab ove, we also want to nd p oints of minimal and maximal
x
,
y
and
z
co ordinates on an edge. The problem of nding the maximal
x
co ordinate on the edge
dened by the intersection of the surfaces
f
1
and
f
2
is the constraint maximization problem
max
f
1
=
f
2
=0
x:
The corresp onding Lagrangian for this problem is
L
(
x; y ; z ;
1
;
2
) =
x
+
1
f
1
(
x; y ; z
) +
2
f
2
(
x; y ; z
)
:
Necessary conditions for p oints of extreme co ordinates are the Kuhn-Tucker conditions of
rst order
r
(
x;y;z
)
L
= (1
;
0
;
0)
t
+
1
r
f
1
+
2
r
f
2
= 0
;
f
1
= 0
;
f
2
= 0
:
By the elimination of the Lagrange multipliers we get the non-linear 3
3 system
f
1
= 0
;
f
2
= 0
;
(5)
f
3
:= (
r
f
1
r
f
2
)
x
= 0
:
5