EIT Agent
登录
← 校园网页目录

校园网页 · 学校官网

doi:10.1016/j.jcp.2007.02.013

An efficient direct parallel spectral-element solver for separable elliptic problems Yuen-Yick Kwan, Jie Shen * Department of Mathematics, Purdue University West Lafayette, IN 47907, USA Received 30 October 2006; received in revised form 29 January 2007; accepted 13 February 2007 Available online 24 February 2007 Abstract An efficient direct parallel elliptic solver based on the spectral element discretization is developed. The direct solver is based on a matrix decomposition approach which reduces multi-dimensional separable problems to a sequence of one- dimensional problems that can be efficiently handled by a static condensation process. Thanks to the spectral accuracy and the localized nature of a spectral element discretization, this elliptic solver is spectrally accurate and can be efficiently parallelized, and it can serve as an essential building block for large scale high-performance solvers in computational fluid dynamics and computational materials science. /C211 2007 Elsevier Inc. All rights reserved. Keywords: Spectral-element; Domain decomposition; Parallel computing; Elliptic solver 1. Introduction In recent years, spectral and spectral-element methods have enjoyed an increased popularity among com- putational scientists who value accurate and reliable numerical approximations. In particular, the spectral- element method (cf. [15]), which combines the advantages of the high accuracy of the spectral method and the geometric flexibility of the finite-element method, has been used successfully in many large scale compu- tations for real life applications (see, for instance, [8,12] and the references therein). For obvious reasons, well-developed spectral-element codes such as NEK5000 (cf. [23]) and NEKTAR (cf. [11]) do not really take advantage of the situations where the domains are simple separable domains, and use in general a suitable iterative procedure to solve the underlying linear systems. However, there are many emerging applications which are set on simple domains but require integrating PDEs with very large numbers of degree of freedoms for a very long time interval. In these situations, it is desirable to have an accurate, fast and direct parallel solver. The goal of this paper is to develop such an elliptic solver based on a spectral- element discretization. We recall that such elliptic solvers based on a (one-element) spectral discretization 0021-9991/$ - see front matter /C211 2007 Elsevier Inc. All rights reserved. doi:10.1016/j.jcp.2007.02.013 * Corresponding author. E-mail addresses: ykwan@math.purdue.edu (Y.-Y. Kwan), shen@math.purdue.edu (J. Shen). Journal of Computational Physics 225 (2007) 1721–1735 www.elsevier.com/locate/jcp are well developed (cf., for instance, [3,10,18,19,25]), but they are not particularly tuned for parallel computations due to the global nature of the (one-element) spectral method. On the other hand, many appli- cations have some localized features, such as layered materials, thin interfaces, that can be better treated by a spectral-element discretization. In practice, a spectral-element discretization is often combined with a domain decomposition approach (cf. [7]). In particular, the technique of static condensation (also known as sub-structuring) is often used to decou- ple the interior unknowns from the interface ones, making direct solvers affordable in one- and two-space dimensions (see, for instance, [5,15]). Nevertheless, for three-dimensional problems, the size of the interface unknowns become prohibitively large to allow a direct method so an iterative technique become necessary (see, e.g., [17,22]). Although optimal preconditioners are available for finite element discretizations, only sub-optimal (with respect to the polynomial degree used in each element) preconditioners are available for a spectral-element discretization (cf. [1,16,22]), making the spectral element solvers (particularly when high- order polynomials are used) considerably more expensive than finite element solvers in three-space dimension. This is one of the reasons why usually relatively low degrees of polynomials ( /C24 12) are used in a spectral-ele- ment discretization. We develop in this paper a direct, parallel spectral-element solver for separable elliptic problems. The solver is based on a matrix decomposition approach [6,13,25] which reduces multi-dimensional problems to a sequence of one-dimensional problems that can be efficiently handled by a static condensation process. The advantages of this solver include: (i) it is a direct solver for both two and three dimensions with a competitive computational complexity; (ii) it can be efficiently parallelized thanks to the localized nature of the spectral- element discretization; and (iii) it allows for larger time step for time-dependent problems since the collocation points are not as close together as in the global spectral methods. The paper is organized as follows. In Section 2, we describe the algorithm and its extension to multi-dimen- sional problems. The parallel implementation is discussed in Section 3. In Section 4, we illustrate the efficiency of the algorithm with several numerical examples. Finally, some concluding remarks are given in Section 5. 2. Description of the algorithm To simplify the notation, we consider the Poisson-type equation with homogeneous Dirichlet boundary conditions au /C0 Du ¼ f ; in X; uj oX ¼ 0; ð2:1Þ where a is a non-negative constant and X is a two- or three-dimensional separable domain. For the purpose of illustration, we shall describe in some detail the solution procedures for two particular cases: (i) X being a 3-D rectangular box, i.e. X ¼ð x/C0 ; xþÞ/C2ð y/C0 ; yþÞ/C2ð z/C0 ; zþÞ; ð2:2Þ and (ii) X being the region between two concentric cylinders, i.e. X ¼f ðr; h; zÞ : r/C0 < r < rþ; 0 6 h < 2p; z/C0 < z < zþg: ð2:3Þ Extensions to other separable elliptic equations with more general and/or non-homogeneous boundary con- ditions are quite straightforward and will be discussed along the way. As the finite element methods, the spec- tral-element method for (2.1) is based on a variational formulation. Let us denote V ¼ H 1 0ðXÞ. Then, the variational formulation for (2.1) is: Find u 2 V such that Aðu; vÞ¼ FðvÞ8 v 2 V ; ð2:4Þ where Aðu; vÞ :¼ aðu; vÞþð r u; rvÞ; FðvÞ :¼ð f ; vÞ; ð2:5Þ and ( Æ, Æ) represents the inner-product in L2(X). 1722 Y.-Y. Kwan, J. Shen / Journal of Computational Physics 225 (2007) 1721–1735 Our basic strategy is to use the matrix diagonalization method (cf. [13]), which is a discrete version of sep- aration of variables , to reduce the multi-dimensional problem to a sequence of one-dimensional problems. Hence, we shall start with the one-dimensional case. 2.1. One-dimensional case Let X =( x/C0 , x+)a n d DK be a partition of ( x/C0 , x+) with K elements: DK : x/C0 ¼ x0 < x1 < /C1/C1/C1 < xK/C0 1 < xK ¼ xþ: and set Xk ¼ð xk/C0 1; xk Þ; k ¼ 1; ... ; K. We now describe the spectral-element method (see, for instance, Chapter 22 in [5] for a similar description). We define the spectral-element space V K N :¼f u 2 V : ujXk 2 PN ; k ¼ 1; ... ; Kg; where PN is the space of polynomials of degree less than or equal to N. Then the spectral-element method for (2.4) in the one-dimensional case is to find uK N 2 V K N such that AðuK N ; vÞ¼ FðvÞ8 v 2 V K N : ð2:6Þ Let f/k i ; i ¼ 1; ... ; N /C0 1g be a set of basis functions (to be specified later) for V k ¼ PN \ H 1 0ðXk Þ,a n d fwk ; k ¼ 1; ... ; K /C0 1g be the piecewise linear hat functions based on the grid fxk ; k ¼ 0; ... ; Kg. Then V K N ¼ spanf/k i ; k ¼ 1; ... ; K; i ¼ 1; ... ; N /C0 1; wk ; k ¼ 1; ... ; K /C0 1g: ð2:7Þ Let us denote by Ak, Bk (k =1 , ... , K) and C the matrices with the elements Ak i;j ¼ Að/k j ; /k i Þ; i; j ¼ 1; ... ; N /C0 1; Bk i;j ¼ Aðwj; /k i Þ; i ¼ 1; ... ; N /C0 1; j ¼ 1; ... ; K /C0 1; Ci;j ¼ Aðwj; wiÞ; i; j ¼ 1; ... ; K /C0 1; and set A ¼ diagðA1; ... ; Ak Þ; B ¼ð B1; ... ; Bk ÞT: Writing uK N as an expansion in the basis functions, i.e. uK N ¼ XK k¼1 XN /C0 1 i¼1 u1 k;i/k i þ XK/C0 1 k¼1 u2 k wk and denoting u1 ¼ð u1 1;1; ... ; u1 1;N /C0 1; ... ; u1 K;1; ... ; u1 K;N /C0 1ÞT; u2 ¼ð u2 1; ... ; u2 K/C0 1ÞT; f 1 ¼ð f 1 1;1; ... ; f 1 1;N /C0 1; ... ; f 1 K;1; ... ; f 1 K;N /C0 1ÞT with f 1 k;i ¼ Fð/k i Þ; f 2 ¼ð f 2 1 ; ... ; f 2 K/C0 1ÞT with f 2 k ¼ Fðwk Þ; where the inner-products Fð/k i Þ and Fðwk Þ are computed with Gauss–Lobatto rule or other numerical inte- gration. Then (2.6) is reduced to the linear system AB BT C /C20/C21 u1 u2 /C20/C21 ¼ f 1 f 2 "# : ð2:8Þ 2.1.1. Static condensation To solve the linear system (2.8), we first compute the Cholesky factorization of A. As we shall demonstrate below, we can choose suitable basis functions such that fAk ; k ¼ 1; ... ; Kg are banded symmetric matrices, so Y.-Y. Kwan, J. Shen / Journal of Computational Physics 225 (2007) 1721–1735 1723 the Cholesky factorization of A can be computed in OðNKÞ operations. With a block Gaussian elimination, (2.8) can be transformed to I eB 0 eC "# u1 u2 /C20/C21 ¼ g1 g2 "# ; ð2:9Þ where eB ¼ A/C0 1B, eC ¼ C /C0 BTA/C0 1B is the Schur complement, and g1 ¼ A/C0 1f 1; g2 ¼ f 2 /C0 BTg1: Note that Bk i;j is nonzero only when j = k /C0 1 and j = k. Hence eB can be computed in OðNKÞ operations. Note that both C and eC are symmetric tridiagonal so u2 can be solved in OðKÞ operations, and then, u1 can be com- puted as u1 ¼ g1 /C0 eBu2: We summarize below the steps and operation counts for solving (2.6), assuming that the input is the vectors f 1, f 2, and the output is the vectors u1, u2. Step Operation count Preprocessing Compute A OðNKÞ Cholesky factorization of A OðNKÞ Compute B OðNKÞ Compute eB ¼ A/C0 1B OðNKÞ Compute C OðKÞ Compute eC ¼ C /C0 BT eB OðNKÞ Solving Compute g1 ¼ A/C0 1f 1 OðNKÞ Compute f 2 OðKÞ Compute g2 ¼ f 2 /C0 BTg1 OðKÞ Compute u2 ¼ eC/C0 1g2 OðKÞ Compute u1 ¼ g1 /C0 eBu2 OðNKÞ 2.1.2. Basis functions We now introduce the basis functions f/k i ; k ¼ 1; ... ; K; i ¼ 1; ... ; N /C0 1g that would result in banded matrices Ak (k =1 , ... , K). Let us consider first the 1D equation reduced from (2.1): au /C0 uxx ¼ f ; in ðx/C0 ; xþÞ; uðx/C0 Þ¼ uðxþÞ¼ 0: ð2:10Þ Introducing the local coordinate ~xk ¼ 2 /C1 x /C0 xk/C0 1 xk /C0 xk/C0 1 /C0 1; x 2 Xk ; ð2:11Þ which transforms the physical domain Xk to the reference domain ( /C0 1, 1). Following [18] we define /k i ðxÞ¼ Li/C0 1ð~xk Þ/C0 Liþ1ð~xk Þ; x 2 Xk ; 0; otherwise; /C26 i ¼ 1; ... ; N /C0 1; ð2:12Þ where Li is the Legendre polynomial of degree i. Then, the elements of Ak are Ak i;j ¼ ahk 2 Z 1 /C0 1 /k j ðxÞ/k i ðxÞ dx þ 2 hk Z 1 /C0 1 ox/k j ðxÞox/k i ðxÞ dx; i; j ¼ 1; ... ; N /C0 1; 1724 Y.-Y. Kwan, J. Shen / Journal of Computational Physics 225 (2007) 1721–1735 where hk ¼ xk /C0 xk/C0 1. Thanks to the orthogonality of the Legendre polynomials, one finds that Ak is symmetric with three nonzero diagonals [18]. Next we consider the following 1D equation which, as we shall we later, appears after applying the matrix diagonalization method to the problem (2.1) in the domain (2.3): au /C0 1 r ðrurÞr þ c r2 u ¼ f ; in X ¼ð r/C0 ; rþÞ; uðr/C0 Þ¼ uðrþÞ¼ 0: ð2:13Þ Here c is a non-negative integer. Treating the variable r in the same way as we treat x, the spectral-element approximation to (2.13) is still (2.6) with the bilinear form Aðu; vÞ and FðvÞ Aðu; vÞ¼ aðu; vÞr þð ur; vrÞr þ c u r ; v r /C16/C17 r ; FðvÞ¼ð f ; vÞr ; where the inner product is: ðu; vÞr ¼ R rþ r/C0 uvr dr. Note that the basis functions (2.12) will lead to full matrices Ak due to the term u r ; v r /C0/C1 r. Hence, we shall use /k 1ðrÞ¼ L0ð~rk Þ/C0 L2ð~rk Þ; r 2 Xk ¼ð rk/C0 1; rk Þ; 0; otherwise; /C26 /k i ðrÞ¼ ð~rk þ ck ÞðLi/C0 2ð~rk Þ/C0 Lið~rk ÞÞ; r 2 Xk ; 0; otherwise; /C26 i ¼ 2; ... ; N /C0 1; ð2:14Þ where ~rk ¼ 2 /C1 r/C0 rk/C0 1 rk /C0 rk/C0 1 /C0 1; r 2 Xk , and ck ¼ rk/C0 1 þrk 2 . Therefore, the elements of Ak are Ak i;j ¼ ahk 2 Z 1 /C0 1 /k j ðrÞ/k i ðrÞðr þ ck Þ dr þ 2 hk Z 1 /C0 1 or/k j ðrÞor/k i ðrÞðr þ ck Þ dr þ 2c hk Z 1 /C0 1 1 r þ ck /k j ðrÞ/k i ðrÞ dx; i; j ¼ 1; ... ; N /C0 1; where hk ¼ rk /C0 rk/C0 1. Then, it can be easily verified that Ak is symmetric with 11 nonzero diagonals. 2.1.3. Some immediate extensions Equations with variable coefficients. It is clear that we can replace Eq. (2.10) by the more general equation: aðxÞu /C0ð bðxÞuxÞx ¼ f ; in ðx/C0 ; xþÞ; uðx/C0 Þ¼ uðxþÞ¼ 0; ð2:15Þ where b(x) > 0 and a(x) P 0 could be piecewise continuous. The only difference is that in case a(x)a n d b(x) are not constants or piecewise constants, the matrices Ak should be computed with a discrete inner product based on the local Gauss–Lobatto quadrature and Ak will be in general full. By the same token, Eq. (2.13) can also be replaced by the more general equation: aðrÞu /C0 1 r ðbðrÞurÞr þ c r2 u ¼ f ; in X ¼ð r/C0 ; rþÞ; uðr/C0 Þ¼ uðrþÞ¼ 0: ð2:16Þ More general boundary conditions. First of all, non-homogeneous boundary conditions can be easily treated by subtracting a suitable simple function satisfying the non-homogeneous boundary condition from the solution, so we shall only deal with homogeneous boundary conditions in this paper. Consider for instance the following general boundary conditions for (2.10) or (2.13) : u xðx/C0 Þþ a/C0 uðx/C0 Þ¼ 0; uxðxþÞþ aþuðxþÞ¼ 0: ð2:17Þ Although in general such boundary conditions are usually handled weakly, as showed in [20], it is, however, beneficial and possible to treat them strongly in a spectral approximation to achieve sparsity for the stiffness and mass matrices. It is clear that one only needs to change the basis functions supported in the two elements which include a boundary point. For example, the basis function / 1 i ðxÞ with support in ( x/C0 , x1) should satisfy ox/1 i ðx/C0 Þþ a/C0 /1 i ðx/C0 Þ¼ 0; /1 i ðx1Þ¼ 0; i ¼ 1; 2; /C1/C1/C1 ; N /C0 1: ð2:18Þ It is shown in [20] that one can uniquely determine ai and bi such that /1 i ðxÞ¼ Li/C0 1ð~x1Þþ aiLið~x1Þþ biLiþ1ð~x1Þ (where ~x1 is the local variable defined in (2.11)) satisfies (2.18). Y.-Y. Kwan, J. Shen / Journal of Computational Physics 225 (2007) 1721–1735 1725 2.2. Multi-dimensional case For the sake of simplicity, we shall start with solving (2.1) in the rectangle X ¼ Xx /C2 Xy ¼ð x/C0 ; xþÞ/C2 ðy/C0 ; yþÞ. The three-dimensional cases (2.2) and (2.3) will be treated afterwards. Eq. (2.1) now reads au /C0 uxx /C0 uyy ¼ f ; in X; ujoX ¼ 0: ð2:19Þ We now describe the spectral-element approximation for (2.19). Given a rectangular grid on X with nodes fðxi; yjÞ : 0 6 i 6 Kx; 0 6 j 6 Ky g, we set V M ¼f v 2 H 1 0ðXÞ : vjðxi/C0 1 ;xi Þ/C2ð yj/C0 1 ;yj Þ 2 PN x /C2 PN y ; 1 6 i 6 Kx; 1 6 j 6 Ky g; ð2:20Þ where M ¼ð Mx; My Þ¼ð N xKx /C0 1; N y Ky /C0 1Þ. Then, the spectral-element approximation to (2.19) is: find uM 2 V M such that AðuM; vMÞ¼ FðvMÞ8 vM 2 V M: ð2:21Þ Let f/x i gMx i¼1 and f/y i g My i¼1 be, respectively, the set of one-dimensional basis functions in the x- and y-direction (described previously for (2.10)). Let us define Ax and Bx, matrices of size Mx, and Ay and By, matrices of size My, with elements Ax ij ¼ð /x j ; /x i Þ; Bx ij ¼ð ox/x j ; ox/x i Þ; Ay ij ¼ð /y j ; /y i Þ; By ij ¼ð oy /y j ; oy /y i Þ: ð2:22Þ Then, writing uM ¼ XMx i¼1 XMy j¼1 uij/x i ðxÞ/y j ðyÞ; Eq. (2.21) reduces to the linear system Lu :¼ð ðaAx þ BxÞ/C10ð Ay þ Ax /C10 By ÞÞu ¼ f ; ð2:23Þ where u and f are vectors with elements ðuÞðj/C0 1ÞMy þi ¼ uij and ðf Þðj/C0 1ÞMy þi ¼ð f ; /x i ðxÞ/y j ðyÞÞX. 2.2.1. Matrix diagonalization method We shall use the matrix diagonalization method (cf. [13]) to solve the linear system (2.23). Recall that A and B are symmetric matrices so there exists a diagonal matrix K and an orthonormal matrix E which solve the generalized eigenvalue problem By E ¼ Ay EK: ð2:24Þ Then, I /C10 ET/C0/C1 /C2 L /C2ð I /C10 EÞ¼ð aAx þ BxÞ/C10 I þ Ax /C10 K: It follows that L/C0 1 ¼ I /C10 E/C0 T/C0/C1 /C2ð ð aAx þ BxÞ/C10 I þ Ax /C10 KÞ/C2ð I /C10 E/C0 1Þ /C0/C1 /C0 1 ¼ð I /C10 EÞ/C2ð ð aAx þ BxÞ/C10 I þ Ax /C10 KÞ/C0 1 /C2 I /C10 ET/C0/C1 : Let v ¼ð I /C10 E/C0 1Þ/C2 u; g ¼ I /C10 ET/C0/C1 /C2 f ; Then the linear system (2.23) becomes ððaAx þ BxÞ/C10 I þ Ax /C10 KÞv ¼ g: ð2:25Þ 1726 Y.-Y. Kwan, J. Shen / Journal of Computational Physics 225 (2007) 1721–1735 Let V and G be Mx · My matrices formed by reshaping the vectors v and g. Then the linear system (2.25) is equivalent to the linear systems ðða þ kjÞAx þ BxÞvj ¼ gj; j ¼ 1; ... ; My ; ð2:26Þ where vj and gj are the columns of V and G. Note that (2.26) corresponds to the linear system resulted from the spectral-element approximation of the one-dimensional equation ða þ kjÞvj /C0 oxxvj ¼ gj; j ¼ 1; ... ; My : We summarize below the steps and operation counts to solve the linear system (2.23). Step Operation count Preprocessing Preparation for solving 1D problem OðMxÞ Solve generalized eigenvalue problem OðM3 y Þ Solving Multiply by I /C10 ET OðMxM2 y Þ Solve 1D problems OðMxMy Þ Multiply by I /C10 E OðMxM2 y Þ Note that we can choose to diagonalize in the direction with fewer points so that the cost of solving above becomes of order OðMxMy minðMx; My ÞÞ. Finally, the complete procedure for solving (2.21) from the input function f at the collocation points to the approximation uM at the collocation points also involve, in addition to the solution of (2.23), the computation of f and the evaluation of uM at the collocation points from the coefficients uij. These two procedures, which are essentially the transformation between the physical values at collocation points and vice versa, involve basically two matrix multiplications which can be performed efficiently in parallel thanks to the localized structure. Note also that after including the costs of these two matrix multiplications, the cost of the whole solver (excluding preprocessing) is still of the order estimated above. When comparing to the domain decomposition method usually used with spectral-element discretization, the new approach results in 1D problems of much smaller size. The size of the Schur complement in the domain decomposition method is of order OðK xKy ðN x þ N y ÞÞ, while the new approach results in OðminðMx; My ÞÞ decoupled tridiagonal systems each of size OðmaxðMx; My ÞÞ. 2.2.2. Three-dimensional rectangular box The 3D Helmholtz equation au /C0 uxx /C0 uyy /C0 uzz ¼ f in a rectangular box can be handled similarly. In this case the Galerkin method reduces to the linear system Lu :¼ð aAx /C10 Ay /C10 Az þ Bx /C10 Ay /C10 Az þ Ax /C10 By /C10 Az þ Ax /C10 Ay /C10 BzÞu ¼ f ; ð2:27Þ where the A-matrices and B-matrices are, respectively, the mass and stiffness matrices in the corresponding directions (see (2.22)). Assume K and E solve the generalized eigenvalue problem BzE ¼ AzEK: Then I /C10 I /C10 ET/C0/C1 /C2 L /C2ð I /C10 I /C10 EÞ¼ð aAx /C10 Ay þ Bx /C10 Ay þ Ax /C10 By Þ/C10 I þ Ax /C10 Ay /C10 K: It follows that L/C0 1 ¼ð I /C10 I /C10 EÞ/C2ð ð aAx /C10 Ay þ Bx /C10 Ay þ Ax /C10 By Þ/C10 I þ Ax /C10 Ay /C10 KÞ/C0 1 /C2 I /C10 I /C10 ET/C0/C1 : Y.-Y. Kwan, J. Shen / Journal of Computational Physics 225 (2007) 1721–1735 1727 Hence the linear system (2.27) reduces to a set of decoupled linear system of the form ðða þ kjÞAx /C10 Ay þ Bx /C10 Ay þ Ax /C10 By Þvj ¼ gj; which corresponds to the 2D Helmholtz equations ða þ kjÞvj /C0 o2 x vj /C0 o2 y vj ¼ gj in a rectangle. 2.2.3. Cylindrical case Consider now the domain between two concentric cylinders described in (2.3). Writing Eq. (2.1) in the cylindrical-polar coordinates and applying a Fourier transform to (2.1) in the h direction, we find that each Fourier coefficient of the solution will satisfy the following two dimensional equation (see, for instance, [21] for more details): au /C0 1 r ðrurÞr þ c r2 u /C0 uzz ¼ f ; in X ¼ Xr /C2 Xz ¼ð r/C0 ; rþÞ/C2ð z/C0 ; zþÞ; ujoX ¼ 0; ð2:28Þ where c is a non-negative constant related to the Fourier mode. Then, the variational formulation for (2.28) is still (2.4) with Aðu; vÞ :¼ aðu; vÞr þð ur; vrÞr þ c u r ; v r /C16/C17 r þð uz; vzÞr; FðvÞ :¼ð f ; vÞr; where ðu; vÞr ¼ R X uvr dr dz. Let f/z i gMz i¼1 and f/r i gMr i¼1 be, respectively, the set of one-dimensional basis functions described previously for (2.10) and (2.13) . Let us define Ar and Br, matrices of size Mr,a n d Az and Bz, matrices of size Mz,w i t h elements Ar ij ¼ð /r j ; /r i Þr ; Br ij ¼ð or/r j ; or /r i Þr þ c /r j r ; /r i r /C18/C19 r ; Az ij ¼ð /z j; /z i Þ; Bz ij ¼ð oz/z j; oz/z i Þ: ð2:29Þ Then the Galerkin method reduces to the linear system Lu :¼ð ðaAr þ BrÞ/C10 Az þ Ar /C10 BzÞu ¼ f ; ð2:30Þ which is ready to be solved by the matrix diagonalization method. Here, one can choose to diagonalize in either the r-o r z-direction. Diagonalizing in the r-direction results in linear systems correspond to 1D equa- tions of the form ða þ kÞv /C0 vzz ¼ g: Since the constant c present in the matrix Br is related to the Fourier mode, solving the full 3D problem will involve solving an eigenvlaue problem for each Fourier mode. On the other hand, diagonalizing in the z-direc- tion results in linear systems correspond to one-dimensional equations of the form ða þ kÞv /C0 1 r ðrvrÞr þ c r2 v ¼ g: In this case the same eigen-pair can be used for all Fourier modes. 3. Parallel implementation Consider first the 1D case. We use K processors (P1 to PK) to solve the 1D problem (2.1), where processor k works on the interval Xk. In other words, processor k has f jXk on input, and computes fu1 k;i; i ¼ 1; N /C0 1g and u2 k/C0 1; u2 k . Each processor can compute Ak, Bk and eBk :¼ð Ak Þ/C0 1Bk independently. 1728 Y.-Y. Kwan, J. Shen / Journal of Computational Physics 225 (2007) 1721–1735 Hence communication between processors is needed only in forming and solving the tridiagonal system eCu2 ¼ g2. Define the inner-product ðu; vÞk ¼ Z Xk uv dx 8u; v 2 L2ðXk Þ; and let Ak , Fk be defined as in (2.5) with the inner-product ( Æ, Æ) replaced by ( Æ, Æ)k. The quantities that proces- sor k can compute with information on hand are ck 1 ¼ Ak ðwk/C0 1; wk/C0 1Þ; ck 2 ¼ Ak ðwk/C0 1; wk Þ; ck 3 ¼ Ak ðwk ; wk Þ; f 1;k ¼ð f 1 k;1; ... ; f 1 k;N /C0 1ÞT; g1;k ¼ð Ak Þ/C0 1f 1;k ; ~f k 1 ¼ Fk ðwk/C0 1Þ; ~f k 2 ¼ Fk ðwk Þ: The relationships between these quantities and the entries of C and f 2 are ck;k ¼ ck 3 þ ckþ1 1 ; k ¼ 1; ... ; K /C0 1; ck/C0 1;k ¼ ck;k/C0 1 ¼ ck 2; k ¼ 1; ... ; K; f 2 k ¼ ~f k 2 þ ~f kþ1 1 ; k ¼ 1; ... ; K /C0 1: Let bk 1, bk 2 be the nonzero columns of Bk. Recall that eC ¼ C /C0 BTA/C0 1B; g2 ¼ f 2 /C0 BTf 1; the entries of eC and g2 are hence ~ck;k ¼ ~ck 1 þ ~ckþ1 2 ; k ¼ 1; ... ; K /C0 1; ~ck/C0 1;k ¼ ~ck;k/C0 1 ¼ ck/C0 1;k /C0ð bk 1ÞTðAk Þ/C0 1bk 2; k ¼ 1; ... ; K; g2 k ¼ ~gk 1 þ ~gkþ1 2 ; k ¼ 1; ... ; K /C0 1; where ~ck 1 ¼ ck 3 /C0ð bk 2 ÞTðAk Þ/C0 1bk 2; ~ck 2 ¼ ck 1 /C0ð bk 1 ÞTðAk Þ/C0 1bk 1; ~gk 1 ¼ ~f k 2 /C0ð bk 2 ÞTg1;k ; ~gk 2 ¼ ~f k 1 /C0ð bk 1 ÞTg1;k : Note that the superscripts on the right-hand sides also denote the precessor in which the value is stored. Hence the coefficients and right-and side of the equation ~ck/C0 1;k u2 k/C0 1 þ ~ck;k u2 k þ ~cu2 kþ1 ¼ g2 k are stored partly ð~ck/C0 1;k ; ~ck 1 and ~gk 1Þ in processor k and partly ð~ckþ1 2 ; ~ckþ1;k and ~gkþ1 2 Þ in processor k +1 . I n other words, processors 1 and K have part of one equation, while the other processors have part of two equations. In the multi-dimensional case, assume that the processors are mapped onto a Cartesian grid. We can solve the eigenvalue problem (2.24) and perform the matrix-matrix multiplications in parallel easily with, for exam- ple, the ScaLAPACK [4]. If one of the dimensions is periodic, the Fourier transform can be performed in par- allel through a parallel matrix transposition. Hence the main issue is to solve the tridiagonal systems (corresponds to the 1D problems resulted from matrix diagonalization, see (2.26)) in parallel. 3.1. Solving the tridiagonal systems A standard algorithm to solve the tridiagonal system is to perform reduction in a top-down fashion (for- ward sweep) followed by a backward substitution in a bottom-up fashion (backward sweep). However, a par- allel code using the above algorithm would require 2 K /C0 2( K being the number of processors) parallel communications and can be very slow on clusters. While there are parallel tridiagonal solvers that only require Y.-Y. Kwan, J. Shen / Journal of Computational Physics 225 (2007) 1721–1735 1729 Oðlog2KÞ parallel communications, they are not directly applicable to our case, since the processors do not store full equations on input. In the following, we develop algorithms specially designed for our situation. For the sake of simplicity (in describing the algorithms), we add two more equations (0 and K) to the tri- diagonal system, so that there are K + 1 equations to solve and processor k has some information of equations k /C0 1 and k. We discuss here two methods to solve the tridiagonal systems in parallel. For simplicity, we only illustrate the case with only one system, i.e. the 1D case. The multi-dimensional case can be easily handled by extending the messages in communications to M times longer. We also assume that K is an integral power of 2. We describe the two methods below. The first one is suitable in case the communication between processors is bidirectional, while the second one is preferable if the communication between processors is multi-port bidirectional. The first method uses a recursive algorithm as follows: 1. For k odd, P K sends its part of equation k (i.e., ~ck/C0 1;k ; ~ck 1 and ~gk 1)t o Pk+1; Pk+1 sends its parts of equations k (i.e., ~ckþ1 2 ; ~ckþ1;k and ~gkþ1 2 ) and k + 1 (i.e., ~ck;kþ1; ~ckþ1 1 and ~gkþ1 1 )t o PK. 2. For k odd, PK uses the full equation k to eliminate unknown u2 k in equations k /C0 1 and k +1 ; Pk+1 keeps the full equation k. 3. The odd-numbered processors altogether now contains the whole system of even-numbered equations. The problem is now reduced to one with half size. The recursion ends when processors 1 and K/2 + 1 altogether contains the whole system involving u2 0; u2 K=2 and u2 K . In this case the two processors exchange information. Processor 1 solve for u2 0 and u2 K=2. Processor K/2 + 1 solves for u2 K=2 and u2 K . 4. For k odd, PK sends the values of u2 k/C0 1 and u2 kþ1 to Pk+1; Pk+1 sends the full equation k to PK. 5. For k odd, PK solves the full equation k and keep u2 k/C0 1, u2 k ; Pk+1 solves the full equations k and keep u2 k , u2 kþ1. Fig. 1 shows the flow of communication with K = 8, in which an arrow denotes a communication and the number above or below an arrow is the length of the message. Assume that the communication is bidirectional. Let ts be the start-up time for a communication and tw be the time for a message of unit length to be sent over the network. Then the parallel run time for the above algorithm is T K ¼ð ts þ tw /C1 5MÞþ T K=2 þð ts þ tw /C1 4MÞ: Solve the above recursive relation with Fig. 1. Flow of communication for the first method. 1730 Y.-Y. Kwan, J. Shen / Journal of Computational Physics 225 (2007) 1721–1735 T 2 ¼ ts þ tw /C1 2M gives T K ¼ð 2ts þ 9MtwÞlog2K /C0ð ts þ 7MtwÞ: The second method is the same as the first one up to step 3. The modification is as follows. Note that after step 3, except for P1 and P K=2 þ 1, all processors contain an equation involving three unknowns. Thus these pro- cessors only need two solved unknowns to solve for another unknown. This cuts the message size to two (in- stead of four when sending the full equation, see step 4 of the first method). The algorithm is quite complicated and is best described by the flow of communication, which is shown in Fig. 2 in the case K = 8. Note that in the lower part of the figure, the numbers above an arrow is the indices of the solved unknowns being sent in- stead of the size of the message. Note that in the second-last step, the processors P 3 and P7 send solved un- knowns to two other processors. Hence the methods work best when the communication is multi-port. Assume that the communication is multi-port and bidirectional. Then the parallel run time of this algorithm for K >2i s T K ¼ð ts þ 5MtwÞðlog2K /C0 1Þþð ts þ 2MtwÞþð ts þ 2MtwÞðlog2K /C0 1Þþð ts þ MtwÞ ¼ð 2ts þ 7MtwÞlog2K /C0 4Mtw: 4. Numerical results We now present several examples which illustrate some of the advantages of this algorithm. All numerical experiments are performed on the IBM-SP2 cluster in Purdue University. The cluster contains 320–375 MHz POWER3-II processors. All codes are written in Fortran77 with MPI. Example 1. We consider the Poisson equation in a layered medium /C0ð aðxÞu xÞx /C0 uyy ¼ 1; 0 < x < 4; 0 < y < 1 ð4:1Þ with homogeneous Dirichlet boundary conditions, where Fig. 2. Flow of communication for the second method. Y.-Y. Kwan, J. Shen / Journal of Computational Physics 225 (2007) 1721–1735 1731 aðxÞ¼ 1:0; 0 < x < 1; 1:5; 1 < x < 2; 2:0; 2 < x < 3; 2:5; 3 < x < 4; 8 >>> < >> > : is a piecewise constant function. It is clear that a direct spectral approximation will lead to an inaccurate result with large oscillations around the discontinuities of a(x). This difficulty can be easily overcome by using a spectral-element method such that the coefficients are smooth within each element, for it has been shown (cf., for instance, [2]) that the convergence rate of the spectral-element method is affected by the ‘‘local smoothness’’ of the coefficients a(x), not the ‘‘global smoothness’’. Here, we implemented a spectral-element method with four equally spaced intervals in the x-direction and one single interval in the y-direction. In Table 1, we list the ‘ 2-errors of the spectral-element approximation with different resolutions. The ‘‘exact’’ solution is computed with a high resolution Nx = Ny = 256. It is clear that the convergence rate of the approximate solu- tion is not affected by the discontinuities of a(x), it is, however, limited by the corner singularity. Example 2. To illustrate the efficiency of the parallel implementation, the 3D Helmholtz equation in a rect- angular box is solved using different number of processors. In the parallel run, the number of processors used is equal to the number of elements K in the x-direction. We fix N y = Nz = 48 while Nx is chosen such that the total degree of freedom is constant. The serial and parallel runtimes (excluding preprocessing time) for differ- ent number of processors are shown in Table 2. We observe from the table that the parallel efficiency is essen- tially 75% or above for all cases. Example 3. To further investigate the parallel efficiency, we solve the axi-symmetric Helmholtz equation in a cylinder (2.28) by subdividing the domain into a 2D grid and using one processor on each subdomain. For each subdomain, we fix N r = Nz = 64 and report in Table 3 the serial and parallel runtimes (excluding time to solve the eigenvalue problem (2.24)) for different number of processors. We observe again from the table that high parallel efficiency (>80%) is achieved for all cases. The preprocessing time on a serial processor is also reported and is roughly the same as the serial runtime for the solver. Note that the computational com- plexities for the solver and the preprocessing are OðK 2 r N 2 r KzN zÞ and OðK3 z N 3 z Þ, respectively. Example 4. The goal of this last example is to validate this spectral-element solver in a complex computational situation and set the stage for future large scale parallel computations. We consider the retraction of a cylindrical filament of radius R = 0.25 and height H = 5.5 placed at the axis of a cylinder of radius R = 1 and height H = 6 filled with another ambient fluid, where the two fluids are incompressible and have the same density and viscosity, we refer to [14] for more detail on the background of this problem. Using the phase-field model, the system governing the mixture of the two fluids can be written as ut þð u /C1r Þ u /C0 mDu þr p þ kr/C1ð r / /C10r /Þ¼ f; r/C1 u ¼ 0; ð4:2Þ and /t þð u /C1r Þ / ¼ cðD/ /C0 f ð/Þþ nðtÞÞ; d dt Z X / dx ¼ 0; ð4:3Þ Table 1 ‘ 2-Errors for Example 1 Nx = Ny 81 6 3 2 6 4 ‘ 2-Error 9.41E /C0 6 2.24E /C0 7 4.43E /C0 9 7.82E /C0 11 1732 Y.-Y. Kwan, J. Shen / Journal of Computational Physics 225 (2007) 1721–1735 where / is the phase function ( / = 1 inside the filament and / = /C0 1 in the ambient fluid), k is the ratio be- tween the kinetic energy and the elastic energy, c is the elastic relaxation time, n(t) is the Lagrange multiplier corresponding to the constant volume constraint in the last equation, and f ð/Þ¼ 1 g2 /ð/2 /C0 1Þ ð4:4Þ with g the thickness of the transition layer. We refer to [24] for a detailed discussion of this model and its numerical method. It is shown in [24] that using a combination of a consistent splitting scheme [9] and a sta- bilized semi-implicit discretization for the phase equation, one only needs to solve a sequence of Poisson-type equations at each time step. While a spectral-Galerkin method was used in [24], we implemented the spectral- element algorithm for the same problem. The parameters used are c ¼ 0:02; k ¼ 0:01; g ¼ 0:02; m ¼ 0:02; dt ¼ 0:005: The computation is carried out with 6 equally spaced elements in the z-direction and 1 element in the r-direc- tion. The resolution used is N x = Ny = 64. Fig. 3 shows the contours of the phase function / with values /C0 0.5 and 0.5 at different times. These results are in good agreement with those reported in [24]. Table 2 Parallel efficiencies for different K in Example 2 Nx K Serial runtime Parallel runtime Parallel efficiency 1024 1 23.7534 – – 512 2 10.9372 5.7433 0.9522 256 4 7.2480 2.4007 0.7548 128 8 5.7776 0.9698 0.7447 64 16 7.0883 0.4522 0.9796 32 32 6.8300 0.2692 0.7928 Table 3 Parallel efficiencies for different K in Example 3 K r · Kz Serial runtime (preprocessing) Parallel runtime Parallel efficiency 2 · 2 0.1866 (0.1271) 0.04777 0.9766 4 · 4 0.9138 (0.8127) 0.06149 0.9288 8 · 8 5.1930 (6.0020) 0.08863 0.9155 16 · 16 32.8372 (43.8713) 0.1569 0.8175 t = 0.0 t = 1.0 t = 1.8 t = 2.4 t = 3.0t = 2.6 Fig. 3. Contours of the phase function / at different time. Y.-Y. Kwan, J. Shen / Journal of Computational Physics 225 (2007) 1721–1735 1733 5. Concluding remarks We presented an efficient, direct, and highly parallel spectral-element algorithm for elliptic equations in sep- arable domains. The solver is particular suitable for domains with large aspect ratio and for problems with layer structures/discontinuous coefficients. Ample numerical experiments indicates that our algorithm achieves very high parallel efficiency ( P75%) for all tested cases which use up to 256 (the largest number of nodes that we have access to) processors. It is expected that this parallel solver can be used as an essential building block for large-scale computations with implicit or semi-implicit schemes on massively parallel computers. Acknowledgments The authors thank Dr. Paul Fischer for suggesting this work and for hosting Kwan as a summer intern at Argonne National Laboratory. This work is partially supported by NSF Grants DMS-0509665 and DMS- 0610646. References [1] I. Babusˇ ka, A. Craig, J. Mandel, J. Pitka ¨ ranta, Efficient preconditioning for the p-version finite element method in two dimensions, SIAM J. Numer. Anal. 28 (3) (1991) 624–661. [2] Christine Bernardi, Yvon Maday, Francesca Rapetti, Discre ´ tisations variationnelles de proble ` mes aux limites elliptiques, Mathe´ matiques & Applications (Berlin) [Mathematics & Applications], vol. 45, Springer, Berlin, 2004. [3] Petter E. Bjørstad, Bjørn Peter Tjøstheim, Efficient algorithms for solving a fourth-order equation with the spectral-Galerkin method, SIAM J. Sci. Comput. 18 (2) (1997) 621–632. [4] L.S. Blackford, J. Choi, A. Cleary, E. D’Azevado, J. Demmel, I. Dhillon, J. Dongarra, S. Hammarling, G. Henry, A. Petitet, K. Stanley, D. Walker, R.C. Whaley, ScaLAPACK Users’ Guide, Society for Industrial and Applied Mathematics, Philadelphia, PA, 1997. [5] John P. Boyd, Chebyshev and Fourier Spectral Methods, second ed., Dover, Mineola, NY, 2001. [6] B.L. Buzbee, G.H. Golub, C.W. Nielson, On direct methods for solving Poisson’s equations, SIAM J. Numer. Anal. 7 (1970) 627– 656. [7] W. Couzy, M.O. Deville, A fast Schur complement method for the spectral element discretization of the incompressible Navier– Stokes equations, J. Comput. Phys. 116 (1) (1995) 135–142. [8] M.O. Deville, P.F. Fischer, E.H. Mund, High-order methods for incompressible fluid flow, Cambridge Monographs on Applied and Computational Mathematics, vol. 9, Cambridge University Press, Cambridge, 2002. [9] J.L. Guermond, Jie Shen, A new class of truly consistent splitting schemes for incompressible flows, J. Comput. Phys. 192 (1) (2003) 262–276. [10] P. Haldenwang, G. Labrosse, S. Abboudi, M. Deville, Chebyshev 3-D spectral and 2-D pseudospectral solvers for the Helmholtz equation, J. Comput. Phys. 55 (1) (1984) 115–128. [11] G.E. Karniadakis, S.J. Sherwin, Spectral/hp Element Methods for CFD, Oxford University Press, Oxford, 1999. [12] George Em. Karniadakis, Spencer J. Sherwin, Spectral/hp Element Methods for Computational Fluid Dynamics, second ed., Numerical Mathematics and Scientific Computation, Oxford University Press, New York, 2005. [13] Robert E. Lynch, John R. Rice, Donald H. Thomas, Direct solution of partial difference equations by tensor product methods, Numer. Math. 6 (1964) 185–199. [14] P.K. Notz, O.A. Basaran, Dynamics and breakup of a contracting liquid filament, J. Fluid Mech. 512 (2004) 223–256. [15] Anthony T. Patera, Fast direct Poisson solvers for high-order finite element discretizations in rectangularly decomposable domains, J. Comput. Phys. 65 (2) (1986) 474–480. [16] Luca F. Pavarino, Olof B. Widlund, Iterative substructuring methods for spectral element discretizations of elliptic systems. I. Compressible linear elasticity, SIAM J. Numer. Anal. 37 (2) (2000) 353–374. [17] Alfio Quarteroni, Alberto Valli, Domain Decomposition Methods for Partial Differential Equations, Numerical Mathematics and Scientific Computation, The Clarendon Press, Oxford University Press, New York, 1999. [18] Jie Shen, Efficient spectral-Galerkin method. I. Direct solvers of second- and fourth-order equations using Legendre polynomials, SIAM J. Sci. Comput. 15 (6) (1994) 1489–1505. [19] Jie Shen, Efficient spectral-Galerkin method. II. Direct solvers of second- and fourth-order equations using Chebyshev polynomials, SIAM J. Sci. Comput. 16 (1) (1995) 74–87. [20] Jie Shen, Efficient Chebyshev–Legendre Galerkin methods for elliptic problems, in: A.V. Ilin, R.R. Scott (Eds.), Proceedings of ICOSAHOM’95, Houston J. Math, 1996, pp. 233–240. [21] Jie Shen, Efficient spectral-Galerkin methods. III. Polar and cylindrical geometries, SIAM J. Sci. Comput. 18 (6) (1997) 1583–1604. [22] Andrea Toselli, Olof Widlund, Domain decomposition methods – algorithms and theory, Springer Series in Computational Mathematics, vol. 34, Springer, Berlin, 2005. 1734 Y.-Y. Kwan, J. Shen / Journal of Computational Physics 225 (2007) 1721–1735 [23] H.M. Tufo, P.F. Fischer, Terascale spectral element algorithms and implementations, in: Proceedings of Supercomputing, Gordon and Bell, London, 1999. [24] X. Yang, J.J. Feng, C. Liu, J. Shen, Numerical simulations of jet pinching-off and drop formation using an energetic variational phase-field method, J. Comput. Phys. 218 (2006) 417–428. [25] Thomas Zang, Dale B. Haidvogel, The accurate solution of Poisson’s equation by expansion in Chebyshev polynomials, J. Comput. Phys. 30 (2) (1979) 167–180. Y.-Y. Kwan, J. Shen / Journal of Computational Physics 225 (2007) 1721–1735 1735

采集于

查看校方原文 ↗