In this part, we consider different questions connected with grid generation. At first, we give an overview over usual grid generation techniques.

Then we consider in detail some of the requirements for the grid generation algorithm we need: the question of numerical stability and the requirements of anisotropic grid generation.

At last, we consider in detail the grid generation algorithm which we consider as optimal for our application and which we have implemented in the grid generation package IBG.

Popular Grid Generation Technics

In this section we consider shortly some popular grid generation technics. This section cannot be considered as an overview over the existent literature. Since grid generation is part of the majority of computer simulations, there is a great number of publications about grid generation, so such an overview will be beyond the scope of this thesis. So we refer only a small subset of the existing literature. So, almost all applications considered here are connected with semiconductor technology. For other overviews see [Castillo1991] , [Glowinski1990] , [George1991] , [Flaverty1989] .

The subdivision of the different algorithms into the methods listed here is obviously artificial. Let's start with methods to create a new grid:

Manual
methods for cases with relatively simple geometries.
Tensor product grids
of lower dimensional grids.
Mapping methods
from a grid with simple geometry (rectangle, triangle) into the real domain (curvilinear coordinates).
Composition
of the grid from sub-grids on simpler subsets.
The advancing front algorithm
The quadtree/octree approach
Element removal
may be used to create a grid inside a region.
Delaunay method
allows to create a grid for a given set of points.
There are also a lot of methods to change a previously defined grid. Usually the previously listed grid generation methods will be combined with some of these grid transformations to obtain the resulting grid. But often only these transformations will be used, for example in time dependent problems to obtain the new grid from the grid for the previous time step.
Local refinement
Point insertion
Grid coarsening
Local transformations
Point shifting
Grid smoothing
Grid deformation
We consider here only methods for the generation of a single grid. But there are also a lot of numerical methods which don't work with a single grid, but use many different grids:

Manual Grid Generation

Here we can distinguish between enumerative methods (if the points, edges, faces and elements of the mesh are explicitly given) and methods for special simple geometries (for example a rectangle) there the connectivity is known in advance.

These methods can be used only for relatively simple geometries. Often they are used for the creation of coarse grid, and refinement will be used to create the resulting grid. Enumerative grid description can be also used as a format for data transfer. Often possibilities for manual grid generation are part of CAD systems, so that the input of geometrical data (with the mouse) is easy for the user.

Tensor Product Grids

Tensor product grids are a simple possibility to obtain a higher dimensional grid from lower dimensional grid generators. There will be three possibilities: These methods allow to use the local refinement possibilities of the lower dimensional grid generator for the higher dimension. But this refinement is not local for the higher dimension. This leads to a lot of unnecessary points. This methods can be successfully used if the problem itself has approximately a tensor product structure. The regular structure of the resulting grid can be exploited for parallelization.

Because of it's simplicity this method is very often used in applications. It can be used also as a start grid for other methods like refinement or for the grid generation on the simple parts of the composition method.

Mapping Methods

Here we have a mapping function which maps the mesh of an easy reference domain onto the real domain.

There are different possibilities to build such a mapping. Usually we start with an identification of some key points of the reference domain and the real domain (for example the corners of the reference rectangle on the real boundary). Then an interpolation formula has to be found, at first for boundary lines, (in 3D also for boundary faces) and than for the inner part of the domain. Often easy interpolation formulas will be used, but it is also possible to solve numerically partial differential equations for this interpolation to obtain better mesh quality.

The computation of the interpolation functions (especially if differential equations will be used) is usually fully automatic, but some information usually has to be fixed or defined "by hand" --- for example the topological information or some key points. The algorithm creates good meshes if the form of the real domain is not too far from the form of the reference domain, sometimes also if it is far away. The grid in the inner of the domain, especially the point density, depends on the form of the boundary, not of the local characteristics of the problem. So this method often will be used in fluid dynamics. Here the flow depends on the boundary, and often it is possible to create grid so that the curved coordinate directions approximately coincide with the flow direction (streamline coordinates).

This method can be used also locally for the composition method. For time-dependent problems it can be used if the geometry doesn't change very much, especially if the topology doesn't change.

Composition

Here the region will be divided into simpler subregions. Then one of the other methods like manual, tensor product, mapping will be used to create a mesh on the subregion, and at last the meshes of the subregions will be composed into the final grid.

The work of subdividing the initial region often has to be done "by hand". It seems difficult to automate this process (see [Joe1986] for such an algorithm). So it often will be used in CAD system so that interactive control can be used. In some sense the octree can be considered as an automatic variant of this algorithm.

Advancing Front Algorithm

Here we start with a given grid on the boundary. The "front" will be initialized by the boundary grid. Then successive triangles (2D) or tetrahedra (3D) will be created on the inner side of the front. Then the front will be updated. The point density inside the region depends on the given boundary discretization, but can be controlled often by additional external criteria. The algorithm is fully automatic. See, e.g. [Jin1993] , [Paolini1988] , [Lo1991] .

The main problem is to avoid self-intersections of the front. There must be used fast self-intersection search algorithms. Another problem, especially for 3D and/or time-dependent problems, is to obtain the initial boundary grid. A change in the boundary mesh usually leads to a big change in the inner of the domain. Especially in 3D the algorithm is very difficult to implement.

Quadtree/Octree Approach

We start with a regular rectangular coarse grid. Then the rectangles (cubes) will be locally subdivided into smaller rectangles (cubes). In regions where the refinement density changes the rectangles (cubes) with different refinement levels on their edges will be subdivided into other elements (triangles, tetrahedra, prisms). Usually regularization techniques will be used to avoid bad elements in these regions (one-level difference rule). To organize this regularization different techniques may be used (propagation, recursive calls, another variant see [Yang1992] ).

This method can be considered as a localization of the tensor product method to avoid the global refinement effect of local refinement. It is possible to generalize this method also to prismatic grids (see [Siebert1993] ).

This method allows anisotropic refinement. The numerical quality of the resulting grid (at least in the inner of the domain) is ideal as for standard FEM as for finite volume discretization also in the case of anisotropic refinement. The grid in the inner of the domain doesn't change if the boundary changes.

A problem for the refinement in this approach is that anisotropic refinement works only in directions which are parallel to the coordinate axes. In other, skew directions we obtain de-facto only isotropic refinement.

The resulting grid doesn't contain the real boundary. So this method has to be combined with a boundary computation methods.

Often quadtrees and octrees will be used for other reasons. They are an ideal data structure for search operations. In 3D this method often will be used only for the generation of a point set which will be triangulated with the Delaunay method (see [Schroeder1990] , [Shepard1991] , [Ramakrishnan1992] , [Tanigushi1993] ). We also use this combination.

Boundary Computation

The region of interest will be included into a grid which is defined in an independent way and not connected with the boundary grid of the region. This may be a regular grid, but it may be also a more complicate grid obtained by the octree method or refinement. Elements which do not intersect the region will be removed, purely internal elements become part of the grid. For elements intersecting the boundary there are different possibilities:

Delaunay Method

The Delaunay grid is a grid which is uniquely (modulo degenerate cases) defined for an arbitrary set of points. It is the dual to the Voronoi tessalation ( [Voronoi1908] , [Delaunay1934] ). There is a well-known algorithm for the generation of a Delaunay grid --- the Watson algorithm. The algorithm is sequential. In every step of the algorithm one point will be included into an existing Delaunay grid, creating a new Delaunay grid (see [Bowyer1981] - [Dey1992] for algorithms for Delaunay grid generation). This step can be used also for the modification of an existing grid by point insertion.

Often the Delaunay grid will be used as a start grid for further modifications. Such modifications are necessary especially in 3D FEM applications, because there may be degenerate tetrahedra in the Delaunay grid which create big problems in FEM discretizations (so called slivers).

Another problem of the algorithm is that in the resulting grid the boundary may be intersected by edges and elements. So grid modifications, for example point insertion or local transformations are necessary to obtain a correct geometry.

The quality of the resulting grid naturally depends on the set of points used. Often this set will be defined by other methods --- for example the octree method. Often the Delaunay grid of the previous step will be used to define new points on places where the grid quality is bad or the grid is too coarse.

Local Refinement

Here we start with a "coarse" grid created by another method like manual grid generation, tensor product grids. This grid will be refined locally to obtain high point density only in regions where it is necessary. We don't consider here the refinement criteria --- this is a very complicate problem which has to be considered separately for every concrete equation. There are different techniques to refine a grid: Usually the numerical quality of the elements of the refined grid is not so good as in the coarse grid. Upper bounds for this effect are possible. Often other techniques (grid smoothing, local transformations) will be used to obtain better grid quality.

Local refinement often will be used for grid generation in multi-grid methods.

Point Insertion

This method can be considered as a variant of the local refinement. But we consider it here as a separate method. To include a point we have different possibilities: Point insertion can be used also to increase grid quality inside a region. So it is possible to start with the Delaunay grid created by given boundary points --- a very coarse grid --- and to include points in the region. The resulting grid depends on the strategy used for point insertion. One strategy is to detect bad elements and to insert a point into such elements. The necessary set of points can be created also independent by other grid generation methods (tensor product grids or the octree method).

Point insertion will be used also to correct the grid near the boundary. So in the Delaunay grid there may be edges going through the boundary. Here we can insert a new boundary point at the place of the intersection with the boundary. Point insertion also can be used to eliminate slivers.

Grid Coarsening

This is the inverse operation to refinement. Especially in time-dependent problems with moving fronts the grid may be too fine in the parts of the grid behind the front. For these cases grid coarsening combined with refinement is a fast alternative to the creation of a new grid.

The grid coarsening algorithm usually depends on the refinement algorithm used. Often some information of the refinement history (for example the order of point creation) have to be saved to make coarsening possible. Then we have to identify refinement patterns which can be reversed.

Another possibility, which doesn't depend on the refinement algorithm used, is to mark some points which have to be removed. Removing a point is in general not so easy as to include a new point. Points which are part of only three triangles or four tetrahedra can be easily removed, but this is a very rare situation. So the environment of the point usually has to be rebuilt to create such a situation.

Local Element Transformations

These are local operations changing the grid without changing the points of the grid. The most important example is the 2D "edge swapping" procedure. Here two neighbour triangles will be replaced by two other triangles by replacing the common edge of the old triangles by the line connecting the other two points. This operation is possible if this line is inside the union of the two triangles. Usually this operation is enough for 2D problems. For example, using only this operation every 2D grid can be transformed into the Delaunay grid.

In 3D the situation is more complicate. The generalization of the edge swapping procedure is not symmetric. It creates (or deletes) one new edge, and often we have situations where it is not possible to use this operation. So it seams necessary to consider also other, more complicate local transformations.

Local transformations usually will be used to eliminate elements with bad quality (triangles with obtuse angles, slivers). They also can be used to remove edges intersecting boundaries.

Shifting Points

Often points will be shifted. There will be a lot of reasons to shift points, and different methods to do this. Let's consider some of these methods:

Grid Deformation

If we have a time-dependent problem with a velocity field the grid for the next time step can be defined by the old grid by shifting the points of the old grid to their new position defined by the velocity and the time step. This operation is obviously very fast. But the quality of the resulting grid may be worse, the grid may be incorrect (overlapping, turning over, etc. of elements). So often this method will be combined with other methods (especially with local transformations) to avoid such effects.

Another possibility is to detect only the correctness of the resulting grid and to create a new grid if a failure will be detected.

About moving elements see also [Smith1992] , [Bank1993] .

Grid Smoothing

The most usual method of grid smoothing is barycentrage: Every point is relocated to the weighted barycentre of it's neighbours (may be including the point itself). This procedure can be iterated. There may be used also other methods to find a more optimal position for the point in it's local environment.

Usually this operation makes the grid better. The main problem of this method is that there is no guarantee. A Delaunay grid may become non-Delaunay. Locally the grid may become even incorrect (overlapping, turning over, etc. of elements). Another problem is that restrictions for the boundary points have to be made. A boundary point can be shifted only on the boundary.

Moving Points to the Boundary

This is another possibility to solve problems which arise around the boundary in boundary computation or Delaunay grids. A point from inside (or outside) the domain will be shifted to a boundary position. As a result edges which intersect the boundary before don't do this after the operation.

An interesting property of this method is that we will have not so much inner points near the boundary. This may be useful for some numerical methods, because we can obtain problems if the Voronoi box of an inner point near the boundary intersects this boundary. On the other hand, the grid may become too coarse near the boundary.