• No results found

Use of background grid

In document Finite Element Mesh Generation (Page 150-156)

Mesh generation on planar domain

Step 10: Meshing by AFT completed

3.6.3 Use of background grid

In MG by the AFT, the check for intersections and the update of the boundary upon the creation of a new element are the most time-consuming steps (Kwok et al. 1995). As shown in examples of adaptive meshes listed in Tables 3.1 and 3.2, in a typical triangular mesh of 152,749 triangular elements, the average number of line segments on the generation front is 16,051. The intersection check on these line segments for the generation of the best valid triangle involves operations of an order 16,0512≈ 2.5 × 108, which is a rather large number to be efficiently handled by a PC. To reduce the amount of computation in geometrical cal-culations, a background grid to localise the searching process could be the most effective, as shown in Figure 3.46, in which line segments associated with a cell are only a small portion of the total population. For an even distribution of line segments, the extent for geometrical check can be much reduced to within a small zone adjacent to the edge under consideration.

dy

dx

Dx, Nx

Dy Ny

Figure 3.46 Line segments intersected by a cell are shown as thicker lines.

3.6.3.1 Construction of the background grid

In 2D, a background grid of N = Nx × Ny cells (boxes, zones, bins) subdivides regularly the domain of interest into a number of regions, such that for any given point, the cell that con-tains it can be determined rapidly without much calculation. As shown in Figure 3.46, the dimensions of a typical cell are given by

d D

Dx and Dy are the lengths of the domain along the x- and y-directions, respectively.

Nx and Ny are the numbers of division along the x- and y-directions, respectively.

N = Nx × Ny is the number of cells in the background grid.

However, in the actual applications, in particular, for adaptive meshing, elements are not evenly distributed, which means that an even distribution of line segments in the cells is not an efficient scheme. A variable allocation scheme of line segments into cells is preferred in which the number of line segments contained in each cell varies from cell to cell dependent on the node spacing function ρ over the given domain.

3.6.3.2 Setting the size of each cell in the grid

Let L be an integer array of size Nm assigned for recording line segments in the cells, and ρ be the node spacing function over domain Ω to be meshed such that

ρ: Ω → R+

The problem is how to determine the size (number of segments to be stored) in each cell k, k = 1 ~ N, according to the given node spacing function ρ in the most optimal manner. The size of cell k, nk, can be estimated based on a weight inversely proportional to the square of the spacing function, i.e.

nk∝ 1 = c c

2 2

ρ ρ for some constant

ρ2 has to be taken simply because ρ only prescribes the linear distance between nodes, whereas the number of line segments in a cell should be related to the area of the cell. Having adopted the weighting relationship, the following can be written:

n N c N c N

where ρk is the node spacing function computed at the centre of cell k, and a more accurate estimation based on more Gaussian points should be employed if the cells of a large area are used. Hence,

n c

k k

2

By construction,

However, usually it is necessary to allow for a minimum number of line segments, say n0 = 10, in a cell, and Equation 3.4 has to be modified as follows:

c Nm n c n N N Nn

To complete the grid system with cells of variable size, an auxiliary integer array P of size N + 1 is also needed as a pointer to mark off the number of line segments in each cell, i.e.

the set of line segments contained in cell k, k = 1 ~ N, is given by {Li, i = Pk + 1, Pk+1} with Pk+1 = Pk + nk

Set P1 = 0. It is easy to see that Pk+1=

nk and PN+1 = Nm, the length of the integer array L holding all the boundary segments recorded in the cells, {Li, i = 1, Nm}. In case ρ is not known for the first mesh, the line segments could be evenly distributed to all the cells, as a relatively coarse mesh is used for the first preliminary analysis. Hence, the number of seg-ments allowed for cell k in the initial mesh n N

k Nm

Figure 3.47 Rectangular domain partitioned into cells, Ne = 10,054.

Consider a 150 × 100 rectangular domain partitioned into 6 × 4 = 24 cells, as shown in Figure 3.47. The node spacing function is characterised with elements clustered along the perimeters of a circle and an ellipse, which could be expressed mathematically as follows:

r x y could be easily determined by Equation 3.5. For n0 = 10, the number of segments allowed for the cells are calculated using four Gaussian points, and the values are listed in Figure 3.47.

3.6.3.3 Marking and unmarking cells intersected by a line segment

As described in Section 2.7.3, there are many ways in finding out the cells intersected by a line segment L for which the following three methods are commonly considered.

i. Method 1: Search by neighbourhood

ii. Method 2: Bounding the cells plus a distance check iii. Method 3: By elimination

In the actual implementation, method 2 is adopted as the distance calculation and is also needed in the determination of the set of boundary segments potentially having an intersec-tion with the base segment L under consideraintersec-tion. Unlike many background-grid construc-tions, the objects contained in each cell are constant throughout for the inquiring need. In MG by means of the AFT, the boundary segments have to be updated whenever a new ele-ment is formed. As a consequence, the line segele-ments contained in each cell are not a static process, and a dynamic marking and unmarking of cells have to be done whenever there is a change of the segments on the generation front.

Whenever new segments are formed with the creation of a new node for the formation of triangle ABC with base segment AB, segments AC and CB are recorded, respectively, to the cells being cut across by the segments, as shown in Figure 3.48a. On the other hand, as

A A A

Figure 3.48 Updated boundary segment upon the creation of triangle ABC: (a) interior point C; (b, c) point C on the front.

shown in Figure 3.48b, when a boundary segment is absorbed as one of the edges of a trian-gular element, the new segment AC has to be marked on the cells being intersected, and at the same time, segment CB has to be deleted by removing it from all the cells containing it in a reverse unmarking process. Similarly, two line segments are to be deleted when boundary segments are used as the sides of a newly formed triangular element with the base segment;

as shown in Figure 3.48c, line segments AC and CB have to be deleted from the boundary by removing them from the cells containing them.

As the generation front changes continuously throughout the MG process, the mark-ing and unmarkmark-ing of boundary segments have to be done accurately in a fully consistent manner. Otherwise, the slightest error in the determination of intersecting cells would very rapidly lead to serious boundary inconsistency, which would only be rectified by examin-ing all the line segments on the current generation front. Fortunately, the unmarkexamin-ing of a line segment is exactly the inverse process of recording a line segment in all the cells being intersected. Hence, also for the rigorous requirement of absolute self-consistency, an identi-cal procedure ought to be applied in marking and unmarking cells being intersected by a particular line segment.

3.6.3.4 Marking cells intersected by a line segment L

Method 2 – bounding the cells plus a distance check will be employed to determine all the cells cut across by line segment L. The essential steps are summarised as follows.

Let (x1, y1) and (x2, y2) be the co-ordinates of the end points of line segment L; calculate

from which the range of the cells being intersected is determined, i.e.

I x d I x d

Let r be the radius of the circle circumscribing cell k; cell k will be included if d ≤ r, where d is the projected distance from the centre of the circle to line segment L, as shown in Figure 3.49.

All cells adjacent to line segment L will be collected to form a list S, such that

L d

Figure 3.49 Cells intersected by line L.

k ∈ S iff k = (j − 1)Nx + i for i = I1→ I2, j = J1→ J2 and d ≤ r

The set of cells intersected by L (cells shaded in Figure 3.49) is denoted by C = {Ck, k ∈ S}.

For each cell Ck, check the line segments contained in it, {Li, i = Pk + 1, Pk+1}, one by one starting from LPk+1. If Li = 0 for some i ∈ {Pk + 1, Pk+1}, set Li = L.

3.6.3.5 Unmarking cells intersected by a line segment L

In the unmarking phase, set C is obtained by collecting all the cells that are intersected by line segment L based on exactly the same procedure for marking cells. For each cell Ck∈ C, check the line segments contained in it, {Li, i = Pk + 1, Pk+1}, one by one starting from LPk+1. If Li = L for some i ∈ {Pk + 1, Pk+1}, then assign Li = Li* and Li* = 0, where i* is the largest value in the list {Pk + 1, Pk+1} for which Li*≠ 0.

3.6.3.6 Search for nearby line segments with the help of the background grid

In MG on 2D by the AFT, a typical scenario for the construction of a new element is to consider a base segment on the generation front. This base segment has to form a triangle with a node on the generation front or with a node strategically created at the interior of the unmeshed region. Whichever the case, the line segments close to the base segment need to be identified to ensure that the new element does not cut into the generation front. With the help of the background grid, the searching process for the neighbouring frontal segments could be made localised, which tremendously speeds up the entire process. Following the procedure of marking and unmarking of cells for a given line segment, the cells intersected by the base segment L could be determined. Let C = {Ck, k ∈ S} be the cells intersected by the base segment L; the set of boundary segments adjacent to L is given by

Λ = = + +

{ ,L i Pi k ,Pk }

k S

1 1

Obviously, Λ is much smaller than the total number of segments on the generation front.

The typical value of the size of Λ is denoted by Nc in Tables 3.1 and 3.2, whereas the num-ber of boundary segments is denoted by Nb. For the largest mesh 2E listed in Table 3.2, the average value of Nb for MG is 101,245 and that for Nc is only 17.78, showing a substantial reduction in searching time especially for dense complicated meshes.

Further screening by simple geometrical checks could be applied to Λ to reduce it to a set Υ of potential line segments for rigorous yet more time-consuming line intersection tests to ensure that the generation front is not cut across by the new element to be created. As shown in Tables 3.1 and 3.2, the size of Υ denoted by Ns is just a tiny fraction of Nc, indicating that rigorous intersection tests are performed only on those boundary segments closest to the base segment with a fair chance of intersection.

3.6.3.7 Updating boundary segments

One characteristic of the AFT is the boundary update whenever a new element is generated.

Without a background grid, a thorough search on the generation front has to be carried out to determine which line segment has been used as an edge of the new element, which has to be identified and removed from the generation front. As the node on the boundary used

for the creation of the new element always comes from the set Υ of potential line segments for intersection, for the boundary update, it is sufficient to search over the set Υ in lieu of the entire set of line segments on the generation front. The set Υ, which has been obtained earlier in the creation of the new element, is a much reduced set compared to all the line seg-ments on the generation front (Ns vs. Nb). The gain in computation time for the boundary update as a by-product in boosting intersection checks is also very significant.

In document Finite Element Mesh Generation (Page 150-156)