Efficient Algorithms and Data Structures for Element-Free Galerkin ...

9 downloads 5365 Views 225KB Size Report
nodes to build an influence domain and construct the shape functions. ... Index Terms—Data structures, element-free Galerkin, kd-tree, meshless, trapezoidal ...
IEEE TRANSACTIONS ON MAGNETICS, VOL. 42, NO. 4, APRIL 2006

659

Efficient Algorithms and Data Structures for Element-Free Galerkin Method Guilherme F. Parreira1 , Alexandre R. Fonseca1 , Adriano C. Lisboa1 , Elson J. Silva2 , and Renato C. Mesquita2 Programa de Pós-graduação em Engenharia Elétrica, Universidade Federal de Minas Gerais, Brazil Departamento de Engenharia Elétrica, Universidade Federal de Minas Gerais, Brazil The element-free Galerkin method (EFG) has specific characteristics that require the usage of techniques and data structures in order to provide efficient calculation. This paper address two problems concerning the EFG implementation. The point location problem, which must find in which subdomain the integration point is located, and the influence domain problem, which must find the nearest nodes to build an influence domain and construct the shape functions. This work proposes the use of new data structures and algorithms in order to solve these problems, speeding up the method and providing a fast and correct influence domain construction. Index Terms—Data structures, element-free Galerkin, kd-tree, meshless, trapezoidal map.

I. INTRODUCTION

U

NLIKE numerical methods based on meshes [e.g., finiteelement method (FEM)], meshless methods like the element-free Galerkin method (EFG) [1] do not have an explicit way to find connectivity—all the EFG connectivity is included in the node neighborhood provided by the influence domain of the shape function. This fact imposes two main challenges to the EFG software. The first is related to the numerical integration, which is totally independent of the nodes distribution. While using Gauss–Legendre quadrature to perform numerical integration, it is necessary to identify in which subdomain each integration point is located, so that the proper material characteristics can be used and the influence domain can be correctly constructed. As there is no connectivity information, this can take a long time to be done. The second challenge is related to the EFG shape function construction, which is based on the moving least squares technique [2]. This technique implies searching for the nearest nodes in the same region of each integration point in order to compute the contributions to the global matrix. This should be performed in every integration point, which slows down the computation if done inefficiently. For these reasons, the EFG is known to be more time consuming than FEM and its main advantage of not generating a mesh cannot be fully explored. In part, it explains the small number of papers dealing with the method in electromagnetics [3], since the domain geometries are complex and a large number of regions and material properties are used. In this paper, we present solutions to these two challenges. We propose some efficient data structures and algorithms that result in a substantial speed-up of the EFG. First, in Section II, we address the point location problem which is a cornerstone to speed up the integration process in EFG. A new sweep algorithm is proposed, implemented, and compared to other traditional approaches. Next, a method based on orthogonal neighbor search is used in Section III to improve the EFG shape construction

Digital Object Identifier 10.1109/TMAG.2006.871432

process. Finally, the interconnection of these ideas is presented in Section IV. II. POINT LOCATION PROBLEM When doing the numerical integration of the EFG weak form, the material characteristics must be known at the integration point. This is important to assure the continuity of the shape functions across the different materials, which implies that all the nodes contained in an influence domain must belong to a unique region [4]. In the EFG method, only nodes are needed to represent the domain and to solve the problem. Since there is no mesh information, the integration of the weak form can be performed by using the Gauss–Legendre method, inserting an artificial grid over the domain. Each integration node will generate contributions to the global matrix and global vector (these contributions are usually called local matrix and local vector). Often, constants related to material characteristics are needed in order to assemble these contributions correctly, so each integration point must know the region to which it belongs. The problem is analogous in two-dimensional (2–D) or threedimensional (3-D) domains and two approaches to address it are proposed in this paper. Both of them are efficient and differ in memory storage, access time, and construction complexity. In order to find the complexity of the algorithms to be shown, some problem parameters should be defined. So, let be the be the number of integration points along the -axis and number of edges in a 2-D domain. A. Trapezoidal Map The trapezoidal map [5] divides the 2-D space into trapezoids, composing a tree data structure. In this tree, there are nodes of two types: the -node, which represents vertices, and the -node, which represents segments. When searching using the trapezoidal map, each step in the tree is at an -node or a -node. If it is an -node, it verifies if the query point is on the left or right side of a vertical line passing through the vertex stored on the node. If it is a -node, it verifies if the query point is on the left or right side of the segment stored on the node. An example can be seen in Fig. 1. It is usually constructed using a

0018-9464/$20.00 © 2006 IEEE

660

IEEE TRANSACTIONS ON MAGNETICS, VOL. 42, NO. 4, APRIL 2006

Fig. 1. Trapezoidal map used to obtain the domain partition.

Fig. 3. Sweep algorithm for point location.

Fig. 2. Sweep algorithm for the integration point location problem.

random construction algorithm, so the complexity times found of expected are always expected times. This structure has memory size, can be constructed in expected time, [5]. and each point location query can be done in The problem while using the trapezoidal map lies in the fact that the tree is randomly constructed. There is no guarantee that the times achieved are, at least, the expected ones. Worst cases domain precould be easily obtained. Besides, a processing also needs to be done before executing the search itself. Moreover, it is not easily expandable to higher dimension domains. To avoid these problems, a new approach needs to be developed. B. Sweep Algorithm Matching an integration point to a region can be done in time only after some domain preprocessing (like the trapezoidal map), which would slow down the integration process. To overcome this, we propose a new sweep algorithm that iterates through the integration points using sweep planes over the problem geometry. sweeps out In the 2-D version of this approach, a line all -axis integration abscissas (see Fig. 2). Each time starts crossing an edge, this is added to a queue of active edges. when finishes crossing it. In this way, It is removed from geometry vertices are edge event points during the sweep and . are stored in an edge event queue The queue contains the region labels of the active edges right side, sorted by the edge position, which are region event (see Fig. 2). The current points to an -axis sweep point region label is initialized with the null region label, and it is crosses a region event point. updated each time The edges are not necessarily axis aligned, so we must also each time we step into update the region event points in a new integration line. This update does not change the region

event points order, only their positions, because the input geometry does not contain intersecting edges (they touch each other only on their vertices). The pseudo-code of the sweep algorithm is given in Fig. 3. Theorem 1: The point location problem can be computed in time and requires storage, is the number of integration points along the -axis where and is the number of edges in the 2-D geometry. Proof: Consider the algorithm in Fig. 3. The step 1 can be time, if we use binary tree or priority queue done in of edge event points. as data structure to store the queue Since an edge of the geometry is added or removed from only once, step 3 can be done in overall time. The , and so step 4 runs in number of active edges is overall time. Steps 6 and 7 are and they are executed times. So the run time is . The storage needed to store the two queues and of elements is . If the same integration points are used more than once, it may pay to store the associated region label, so that point location after the first time, while requiring runs in time storage. Note that if , one can change the orientation of is more significative on the complexity the sweep line, since equation. Furthermore, there is no need to store the coordinates of all integration grid points while using the sweep algorithm. Only the axis abscissas are enough, leading to a storage. The proposed algorithm was implemented. In order to validate it, a comparative to some classical point location algorithms was made: a naive algorithm that iterates over all vertices and edges of the problem; the trapezoidal map algorithm, which creates a random trapezoidal map based on the given geometry and creates a tree to navigate through it; and the walk along a line algorithm, which improves the naive one. One can see a revision of these algorithms in [5]. All these algorithms are a tradeoff between running time and memory space. A template version of the sweep algorithm was implemented in C++ and a Pentium 4 1.72 GHz was used to perform the tests that follow. The first analysis concerns the number of queries made, namely, the number of integration points. For this test, we

PARREIRA et al.: EFFICIENT ALGORITHMS AND DATA STRUCTURES FOR ELEMENT-FREE GALERKIN METHOD

661

TABLE I RUN TIMES

OF POINT LOCATION ALGORITHMS FOR IN THE NUMBER OF QUERIES (40 EDGES)

CHANGES

TABLE II RUN TIMES OF POINT LOCATION ALGORITHMS FOR CHANGES IN GEOMETRY COMPLEXITY (160 000 INTEGRATION POINTS)

THE

Fig. 4. Influence domain construction.

provided a reasonable complex domain in order to evaluate the correctness of the algorithms. The geometry used consists in concentric squares with sides of different sizes. Each region have different materials and the minor square is a hole where the integration should not be performed. The results are shown in Table I. It can be seen that the time increase is linear with the number of queries (as expected from Theorem 1). Then, considering a fixed geometry complexity, a single query takes time within the sweep algorithm. only The test results in Table II show the time spent by all the aforesaid algorithms as a function of the geometry complexity (number of edges in the geometry). While the naive and the walk along a line algorithms have a low memory cost, their time increases enormously as the geometry complexity rises. The trapezoidal map has lower times, however, it is slower than the sweep algorithm. Besides, the former cannot be easily generalized to higher dimensions as can the latter. III. INFLUENCE DOMAIN PROBLEM To compute the local matrix, it is necessary to build the EFG shape functions. Differently from polynomial shape functions often used in FEM, meshless methods based on the moving least squares technique (like EFG) present much more complicated shape functions that require special attention in their calculation. (1a) (1b) (1c) (1d) The shape function construction equations can be seen in (1). The indices 1 to in (1c) indicate the nodes where the weight is different from zero. The weight function

function must have compact support. In this case, a linear basis is used as described by . So, is the point where the shape functions will be evaluated (integration point) and are the nodes whose shape functions have support over . For a full description of the shape function construction, see [6]. computation requires a search of the The shape function neighbor nodes of each integration point. To avoid a brute-force algorithm, a variety of orthogonal search systems can be used, such as the kd-tree, the range-tree, and the octree [5]. In EFG, each node has a parameter called the node influence domain size . It is the support of its shape function. In higher dimensions, this support can be radial or orthogonal, which will generate spherical and boxed influence domains, respectively. For reasons that will be seen, orthogonal supports will be preferred. For each integration point, it is necessary to compute the shape functions that have support over the point. If all the nodes have the same influence domain size and orthogonal supports are used, the search for the nodes which have these shape functions can be done in an inverse way: instead of searching for which boxes contain the point, we can create an artificial box surrounding the integration point and query which data nodes are inside the box, as can be seen in Fig. 4. These nodes will have shape functions covering the integration point and they will be used in the shape function computation. In this kind of search, a box centered on the integration point is created in such way that the weight function support is constant in each direction and all data nodes inside this area will influence that integration point. In order to use different influence domain sizes for the data nodes, this query can still be done by creating a different distance metric that satisfies the orthogonal searching. The orthogonal searching can be done in many ways using a variety of data structures. Among these strategies, a relationship between the memory cost, construction time, and access time must be taken into account. The kd-tree [7] was chosen for its reasonable complexity times and it can be easily extended to 3-D domains. Since this tree was earlier designed for point queries, it fits well for the problem. A kd-tree of a set of nodes uses

662

IEEE TRANSACTIONS ON MAGNETICS, VOL. 42, NO. 4, APRIL 2006

TABLE III INFLUENCE DOMAIN CONSTRUCTION TIMES

material properties will be used while assembling the local contributions. The entire flowchart runs in time. This simplifies to in most applications, where we have increasing integration points and data nodes cardinalities for the same geometry. As , the number of neighbor nodes, is generally constant, the overall complexity . can be finally simplified to V. CONCLUSION

Fig. 5. Schema of the algorithm and data structure usage.

storage and can be constructed in time [5]. The , orthogonal neighbor search can be done, then, in where is the number of neighbor reported nodes. This idea was implemented in C++ and compared to the traditional search strategy for a squared domain problem with data nodes and integration points distributed uniformly. The point location strategy adopted was the sweep algorithm and the influence domain size of the nodes was set to 1.5 times the distance between them. The search time was measured in a Pentium 4 1.72 GHz and the total time spent can be seen in Table III. A speed-up of 12.8 times was obtained in the largest problem. IV. APPLICATION OVERVIEW To build an efficient EFG software, one can interconnect both ideas presented in this work. The schema in Fig. 5 shows how to perform it. In order to enforce the continuity of the unknown function, shape functions in a region should not overlap shape functions on other regions, so each region should maintain a kd-tree of its nodes. Then, the sweep algorithm iterates over the integration grid and provides the region that contains the present integration point. With this information at hand, it is known where the orthogonal neighbor search must be done, and also the correct

In this work, several data structures and techniques that speed up essential calculations in EFG were presented. The generalization of these techniques to 3-D domains is straightforward. The new efficient algorithm based on the sweep strategy for point location can also be applied in other contexts of grid meshes, such as the finite difference method. As the number of integration points increases, the new point location can be done , instead of achieved by other data in structures. For the influence domain construction, a kd-tree data structure using the orthogonal neighbor search was used to bring robustness to the method and to speed it up. The time spent with this technique was measured and a speed-up of 12.8 times was obtained in the largest problem. The greatest improvements in performance came from the creation of a new sweep algorithm and the adaptation of standard data structures and algorithms strategies to deal with the special characteristics of the EFG. ACKNOWLEDGMENT This work was supported by Brazilian agencies CAPES and CNPq. REFERENCES [1] T. Belytschko, Y. Y. Lu, and L. Gu, “Element-free Galerkin methods,” Int. J. Numer. Meth. Eng., vol. 37, pp. 229–256, 1994. [2] P. Lancaster and K. Salkauskas, “Surfaces generated by moving least squares methods,” Math. Comput., vol. 37, no. 155, pp. 141–158, Jul. 1981. [3] V. Cingoski, N. Miyamoto, and H. Yamashita, “Element-free Galerkin method for electromagnetic field computations,” IEEE Trans. Magn., vol. 34, no. 5, pp. 3236–3239, Sep. 1998. [4] L. W. Cordes and B. Moran, “Treatment of material discontinuity in the element-free Galerkin method,” Comput. Meth. Appl. Mech. Eng., vol. 139, no. 1–4, pp. 75–89, Dec. 1996. [5] M. de Berg, M. van Kreveld, M. Overmars, and O. Schwarzkopf, Computational Geometry, 2nd ed. Berlin, Germany: Springer-Verlag, 2000. [6] J. Dolbow and T. Belytschko, “An introduction to programming the meshless element free Galerkin method,” Arch. Comput. Meth. Eng., vol. 5, pp. 207–241, Jul. 1998. [7] J. L. Bentley, “Multidimensional binary search trees used for associative searching,” Commun. ACM, vol. 18, no. 9, pp. 509–517, Sep. 1975.

Manuscript received November 21, 2005 (e-mail: [email protected]).