Professional Documents
Culture Documents
W. D. Henshaw
Center for Applied Scientific Computing, Lawrence Livermore National Laboratory, Livermore, CA, USA
Abstract. We are interested in building structured overlap- olation points and ‘hole regions’ (parts of grids that
ping grids for geometries defined by Computer-Aided-Design are unused) are computed automatically using the
(CAD) packages. Geometric information defining the bound- Ogen overlapping grid generator [2]. Ogen is part
ary surfaces of a computation domain is often provided in of the Overture object oriented framework which
the form of a collection of possibly hundreds of trimmed
can be used to generate grids and solve partial
patches. The first step in building an overlapping volume
grid on such a geometry is to build overlapping surface
differential equations [3,4].
grids. A surface grid is typically built using hyperbolic grid The first step in building overlapping volume
generation; starting from a curve on the surface, a grid is grids is the generation of a set of overlapping
grown by marching over the surface. A given hyperbolic surface grids. Both the surface and volume grids
grid will typically cover many of the underlying CAD surface are typically generated using a hyperbolic marching
patches. The fundamental operation needed for building algorithm [5]. The description of the geometry is
surface grids is that of projecting a point in space onto the often in the form of a collection of trimmed patches
closest point on the CAD surface. We describe a fast and (see Fig. 1). The output from a CAD program will
robust algorithm for performing this projection which makes often be saved in a standard file format such as
use of a fairly coarse global triangulation of the CAD IGES or the newer STEP specification. The descrip-
geometry. Before the global triangulation is constructed the
tion defines a boundary-representation (B-rep) of the
connectivity of the model is determined by an edge-matching
algorithm which corrects for gaps and overlaps between
geometry, as opposed to say a solid-model represen-
neighbouring patches. tation. Unfortunately, the typical IGES output file
does not include any connectivity (topology) infor-
Keywords. CAD models; Grid generation; Hyper- mation; that is there is no information specifying
bolic; Overlapping grids; Surface grids
1. Introduction
In this paper, we describe a fast method to generate
hyperbolic surface grids on CAD geometries. We
are motivated by the problem of grid generation on
geometrical configurations defined by computer
aided design (CAD) programs. In our approach we
build a set of structured overlapping grids [1] that
cover the computational domain. The grids are
allowed to overlap which simplifies the grid con-
struction process compared to the multi-block
approach. The overlapping grids are connected
through interpolation. The location of the interp-
how a given patch connects to other neighbouring implementation of the stitching algorithm, we have
patches. To further complicate matters the trimmed found the edge-curve merging approach to be fast
patches will often be inaccurate, or contain mistakes, and quite robust. One reason why it works well is
making it difficult to determine where two neigh- that it implicitly assumes the boundaries of the
bouring patches should be joined. As a first step in trimmed-patches consist of piecewise smooth seg-
the grid generation process this connectivity infor- ments that should either match to a smooth segment
mation must be determined. As a second step we of a neighbouring patch or be on the boundary of
build a global triangulation of the surface where the surface. This additional assumption can be used
the triangulation will respect the boundaries of the to resolve most ambiguous cases.
trimmed patches. The fundamental operation needed Once the edge-curves have been matched and
for building surface grids is that of projecting a the topology determined we then form a global
point in space onto the closest point on the CAD triangulation for the patched surface. The initial step
surface. The global triangulation will be used to aid in forming this global triangulation is to build a
in this projection step. In order to project a point triangulation on each trimmed patch. The triangu-
onto the surface we first project onto the global lation of each patch is performed in the two-
triangulation and then project onto a particular sur- dimensional parameter space, permitting the use of
face patch. fast triangulation algorithms. The triangulation on
One possible method to determine the connectivity each patch will have boundary nodes that are defined
of a patched CAD model is the stitching algorithm by the merged edge-curves. This means that the
described by Barequet et al. [6,7]. In this technique separate surface triangulations can be connected
the boundaries of the trimmed patches are approxi- together since they will share boundary nodes with
mated as polygons and the algorithm attempts to a neighbouring patch.
stitch together the polygonal representations. Initially There are a number of issues that must be
we implemented an algorithm along these same addressed when triangulating trimmed surfaces and
lines, and although it worked well in many cases there are many papers on this subject [11,12]. Usu-
there were a number of situations that caused diffi- ally, the trimmed surface is tesselated in parameter
culties; overlapping patches and extremely thin space and the resulting triangles are mapped onto
patches were especially troublesome. Admittedly, we the three-dimensional surface. Care must be taken
used a less sophisticated approach than that of Bare- to avoid having poorly shaped triangles in three-
quet and Sharir [6]. dimensions since the triangles can be badly
An alternative way to determine the topology is deformed by the mapping to the three-dimensional
the edge-curve approach described by Steinbrenner surface. Cho et al. [12,13] describe an approach for
et al. [8], whereby the boundary edges of a trimmed generating high quality triangulations on trimmed
surfaces are merged with the boundary edges of surfaces by creating a mapping from two-
neighbouring patches. The basic idea of this method dimensional parameter space to the three-dimen-
is used in a number of CAD fix-up programs [9,10]. sional surface that approximately preserves dis-
We have implemented our own variation of this tances. Marcum and Gaither [14] describe how to
scheme. This technique begins by building curves generate quality triangulations across collections of
(edge-curves) on the boundaries of all trimmed- patches surfaces so that the tessellation need not
patches and then attempts to identify where an edge- conform to the internal patch boundaries. In our
curve from one patch matches to the edge-curve of approach we do not use the triangulation as part of
a neighbouring patch. It is usually necessary to split the final grid so that we only require reasonable
the edge-curves at appropriate locations in order to quality meshes. We use a simple bilinear transform-
perform the matching. When two edge-curves are ation of the parameter space to improve the quality
identified to be the same we say the edges have of the triangles. In addition we require the triangu-
been merged and choose one edge-curve to define lations to conform to the boundaries of the surface
the boundary segment for both patches. By merging patches so that each triangle lies on exactly one
edge-curves we effectively remove any gaps or over- patch.
laps present in the original representation. The The global triangulation serves as a basis for a
details of algorithm described here differ in a variety fast algorithm for projecting points onto the patched
of ways from that of Steinbrenner et al. [8], such surface. This projection algorithm is used by the
as in the representation of the edge-curves, the order hyperbolic surface grid generator. The projection
of the merging and splitting operations and the data algorithm can also be useful for other purposes such
structures used for searching. In contrast to our as building a high quality surface triangulation. To
An Algorithm for Projecting Points onto a Patched CAD Model 267
nectivity stage would include large gaps between edge-curve is a parameter line on a NURBS then
patches or multiple definition of patches (sometimes the edge-curve is itself a NURBS. In other cases it
the exact same trimmed patch may appear more would be too difficult to build an exact represen-
than once in the CAD file!). These errors are usually tation of the curve so instead we sample the curve
easily found by visually inspecting the set of merged at some appropriate number of points and then fit
and unmerged curves. There should, for example, a curve to these points. The two-dimensional arc
only be unmerged curves on the boundary of the length and curvature of the curve are used to deter-
surface. There are many other approaches to fixing mine how many points to use. The number of points
CAD and removing unwanted details [9,10]. used to represent the curve is usually much finer
There are two main steps in determining how than the number of points used when triangulating
sub-surfaces are connected: the surface, which is determined from the user-
specified parameter ⌬ST. Usually we parameterize
build edge-curves: build curve-segments that lie on the 3D edge-curve using the parameterisation of the
the boundary of each sub-surface. A sub-surface 2D trimming curve unless the parameterisation is
defined by a NURBS, for example, will have four poor and then we parameterize by the three-
boundary curve segments. A sub-surface defined by dimensional arc length. In general a single trimming
a trimmed-mapping will have boundary segments curve will be represented in the CAD file as a
corresponding to each trimming curve. A single collection of sub-curves (Fig. 2). Normally each sub-
trimming curve may be split into multiple boundary- curve will be smooth with no corners. When a
segments, if the trimming curve was originally rep- trimming curve is created from a CAD file these
resented that way in the CAD file, or if the curve sub-curves are joined into a single composite curve.
was split at corners. In addition to the composite curve we also keep the
merge/split edge-curves : we examine the curve- original sub-curves. These sub-curves will usually
segments to look for matching segments. If two correspond to the curve of intersection between two
segments agree (at a few number of points to some surface patches and thus be exactly the edge-curves
tolerance) we declare that the segments are the same that we wish to merge. In some cases a trimming
(i.e. that they both represent the true boundary curve will not be smooth; a piecewise linear
curve). Where two segments are the same, we also NURBS, for example, can have sharp corners, and
declare that their respective sub-surfaces are joined. even higher-order NURBS can represent corners
It may be necessary to split a curve-segment into using multiple knots. Such trimming curves are split
two or more pieces so that the pieces can be joined into smooth sub-curves by looking for multiple knots
to other segments. After merging all possible curve- and detecting corners where the direction of the
segments we should have matched all sub-surfaces tangent vector changes rapidly.
where they join other sub-surfaces, thus determining After the edge-curves have been built we attempt
the topology of the surface. to merge the edge-curves. The merging step consists
of two phases (see Fig. 3). In the starting phase we
There are two user-adjustable parameters that are examine all the original edge-curves and look for
used in computing the connectivity and the triangu- matching curves. We use an ADT tree to search for
lation: possible matching edge-curves. The ADT tree holds
⑀merge: the merge tolerance indicates the maximum the bounding box for each edge-curve. To determine
distance between two edge-curves when determining if a given edge-curve, e, matches to some other
candidates for merging or splitting. edge curve we put a small box, of size 2⑀merge,
⌬ST: a user specified arc-length to suggest how around one end-point of e and search for intersec-
many points to place on each edge-curved when tions with the bounding boxes of other edge-curves.
triangulating the surface. For any candidate edge-curve found in this way we
then check more carefully that the curves agree at
These parameters are given default values based the end points and some number of interior points.
on the scale of the CAD model surfaces. We check that the distance between these points is
Trimming curves are usually defined in the two- less than or equal to the merge tolerance ⑀merge. In
dimensional parameter space of the patch. To com- practice we have only found it necessary to compare
pare edge-curves from different patches we must the edge-curves at the end points and the midpoint.
build three-dimensional representations for the edge If two edges agree then we define the edges to be
curves. In some cases we can build an exact rep- merged. One of the edge-curves is defined to be the
resentation of the edge curve. For example, if the merged edge-curve. In the second phase we consider
An Algorithm for Projecting Points onto a Patched CAD Model 269
to be sufficiently fine for this walking method to the unit cube we instead take the grid spacing in
give a reasonable answer. In our experience, the parameter space to be 1, ⌬r = ⌬t = 1. The basic
walking method works without difficulty unless the marching equations to determine the surface grid
user has chosen ⌬ST to give an extremely coarse tri- x(r,t) given the initial curve x(r,0) are defined by
angulation. the hyperbolic PDE
If we do not have an initial guess we use a xt = S(r,t) n(r,t)
global search to find the closest point on the triangu- x(r,0) = x0(r), initial curve
lation. The global search uses an ADT tree in which C(x(r,t) =0, grid is constrained to C(x) = 0
we have stored the bounding boxes for all triangles B(x(r,t)) = 0, boundary conditions
on the global mesh. We look for the intersection of
a box around the target point with the triangle where
bounding boxes; this will determine potential tri- xr ⫻ ns
angles to check. The ADT tree is a fast way to n(r,t) = , normal to the front
answer this query. Given a list of potential triangles 储xr ⫻ ns储
ns : normal to the surface C at x
we check each one to determine the closest point.
The only parameter in this search is the size of the S(r,t) : scalar speed function
bounding box around the target point. It should not and the norm 储·储 is defined by 储f储2 ⬅ f·f. These
be too large nor too small. We start with a safe equations march the grid in the direction locally
value and then increase or decrease the box size orthogonal to the current front. The parameter t is
depending on the number of intersections found. a time like variable. At each unit interval in time
Each triangle on the global triangulation lies on we generate a new grid line.
exactly one surface-patch. Once the closest triangle Note that the normal to the front, n, is the
has been found we then suppose that the closest marching direction for the front and should not be
point on the surface will lie on the patch pointed confused with the ns, the normal to the surface
to by the triangle. This assumes that the surface we are marching over. The speed function S(r,s,t)
triangulation resolves the surface to a reasonable determines how fast the front propagates; it can
degree. If the target point lies very near the bound- depend on local properties of the front. Smoothing
ary between two patches it could be that the true is also added to the equations so we actually solve
projected point is on the neighbouring patch. For a parabolic equation of the form
now we have ignored this possibility, although it
xt = S(r,t)n + ⑀(r,t)xrr
would be possible to deal with this case. For our
purposes so far it does not seem to be an issue. There are a variety of ways to define the speed
function S. See Henshaw [5] for some possible
approaches. These nonlinear parabolic equations are
5. Hyperbolic Surface Grid linearised and discretised using an implicit method.
Generation The implicit matrices are solved with an approxi-
mate factorization requiring the formation and
Structured surface grids can be generated using solution of a block tridiagonal matrix. At each step
hyperbolic grid generation. This approach was the positions of the new grid points are predicted
developed by Steger, Chan and Buning [19,20,21] through the solution of the implicit method. These
and is also available in Gridgen (see Steinbrenner predicted points are then projected onto the under-
and Chawner [22]). We have implemented our own lying CAD geometry using the projection algorithm
version within the Overture framework [5]. described earlier.
Rather than have separate codes for surface and Figure 6 shows an example of growing a surface
volume grid generation we have a single program grid over a CAD surface. The user may optionally
that can generate 2D or 3D volume grids and 3D project onto the original CAD surface or simply
surface grids. The algorithms in all cases are basi- project onto the triangulation. The original surface
cally the same. For surface grid generation we have description could also just be a triangulation. We
the additional boundary condition that the grid have been generating grids on CAD surfaces for
points should lie on the defining boundary surface, some years. However our previous projection algor-
which we denote by C(x) = 0. ithm, which did not take advantage of the unstruc-
Let (r,t) denote the parameter space tured grid, was not as robust and quite a bit slower
(computational) coordinates for the hyperbolic sur- than the current approach. Figure 7 shows an
face grid. Instead of taking parameter space to be example of an overlapping grid that generated using
272 W. D. Henshaw
6. Conclusions
software can be obtained from http://www.llnl.gov/ surface meshing. 8th International Meshing Roundt-
casc/Overture. able, 299–309
10. Sheffer, A., Blacker, T., Clements, J., Bercovier, M.
(1997) Virtual topology operators for meshing. 6th
International Meshing Roundtable, 49–66
11. Piegel, L.A., Richard, A.M. (1996) Tessellating
Acknowledgments trimmed NURBS surfaces. Comput.-Aided Design,
27(1), 16–26
Thanks to Kyle Chand and Anders Petersson for help with 12. Cho, W., Patrikalakis, N.M., Peraire, J. (1998)
the work presented here. Approximate development of trimmed patches for sur-
This work was performed under the auspices of the face tessellation. Comput.-Aided Design, 30, 1077–
U.S. Department of Energy by the University of California, 1087
Lawrence Livermore National Laboratory under contract 13. Cho, W., Maekawa, T., Patrikalakis, N.M., Peraire, J.
No. W-7405-Eng-48. (1999) Topologically reliable approximation of
trimmed polynomial surface patches. Graphical
Models Image Process., 61(2), 84–109
14. Marcum, D., Gaither, J.A. (1999) Unstructured surface
grid generation using global mapping and physical
References space approximation. 8th International Meshing
Roundtable, 397–406
1. Chesshire, G., Henshaw, W.D. (1990) Composite over- 15. Bonet, J., Peraire, J. (1991) An alternating digital
lapping meshes for the solution of partial differential tree (ADT) algorithm for 3d geometric searching and
equations. J. Comp. Phys., 90(1), 1–64 intersection problems. Int. J. Numer. Meth. Eng., 31,
2. Henshaw, W.D. (1998) Ogen: An overlapping grid 1–17
generator for Overture. Research Report UCRL-MA- 16. Formaggia, L. (1999) Data structures for unstructured
132237, Lawrence Livermore National Laboratory mesh generation. In: Thompson, J.F., Soni, B.K., Wea-
3. Brown, D.L., Henshaw, W.D., Quinlan, D.J. (1999) therill, N.P. (Editors), Handbook of Grid Generation,
Overture: An object-oriented framework for solving CRC Press, 1–22
partial differential equations on overlapping grids. 17. Petersson, N. A., Chand, K.K. (2001) Detecting
Object Oriented Methods for Interoperable Scientific translation errors in CAD surfaces and preparing geo-
and Engineering Computing, SIAM, 245–255 metries for mesh generation. Proc. 10th International
4. Brown, D.L., Henshaw, W.D., Quinlan, D.J. (1999) Meshing Roundtable
Overture: Object-oriented tools for overset grid appli- 18. Shewchuk, J.R. (1996) Triangle: Engineering a 2D
cations. Research Report, AIAA conference on Quality Mesh Generator and Delaunay Triangulator.
Applied Aerodynamics UCRL–JC–134018, Lawrence In: Lin, M.C., Manocha, D. (Editors), Applied Compu-
Livermore National Laboratory tational Geometry: Towards Geometric Engineering:
5. Henshaw, W.D. (1999) The Overture hyperbolic grid Lecture Notes in Computer Science 1148, Springer-
generator, user guide, version 1.0. Research Report Verlag, 203–222
UCRL–MA–134240, Lawrence Livermore National 19. Chan, W.M., Steger, J.L. (1992) Enhancements of a
Laboratory three-dimensional hyperbolic grid generation scheme.
6. Barequet, G., Sharir, M. (1995) Filling gaps in the Appl. Math. Computat. 51, 181–205
boundary of a polyhedron. Comput. Aided Geometric 20. Chan, W.M., Buning, P.G. (1994) A hyperbolic sur-
Design, 12(2), 207–229 face grid generation scheme and its applications. Paper
7. Barequet, G., Duncan, C.A., Kumar, S. (1998) RSVP: 94–2208, AIAA
A geometric toolkit for controlled repair of solid 21. Chan, W.M. (1999) Hyperbolic methods for surface
models. IEEE Trans. Visualization and Comput. and field grid generation. In: Thompson, J.F., Soni,
Graph. 4(2), 162–177 B.K., Weatherill, N.P. (Editors), Handbook of Grid
8. Steinbrenner, J.P., Wyman, N.J., Chawner, J.R. (2000) Generation, CRC Press, 1–26
Fast surface meshing on imperfect CAD models. 9th 22. Steinbrenner, J.P., Chawner, J.R. (1999) Gridgen’s
International Meshing Roundtable. (www.andrew.cmu. implementation of partial differential equation based
edu/user/sowen/imr9.html) structured grid generation methods. 8th International
9. Mezentsev, M., Woehler, T. (1999) Methods and Meshing Roundtable (www.andrew.cmu.edu/user/
algorithms of automated CAD repair for incremental sowen/imr8.html)