Introduction to Spectral Methods

Introduction to Spectral Methods

Introduction to spectral methods Eric Gourgoulhon Laboratoire de l’Univers et de ses Th´eories (LUTH) CNRS / Observatoire de Paris Meudon, France Based on a collaboration with Silvano Bonazzola, Philippe Grandcl´ement,Jean-Alain Marck & J´eromeNovak [email protected] http://www.luth.obspm.fr 4th EU Network Meeting, Palma de Mallorca, Sept. 2002 1 Plan 1. Basic principles 2. Legendre and Chebyshev expansions 3. An illustrative example 4. Spectral methods in numerical relativity 2 1 Basic principles 3 Solving a partial differential equation Consider the PDE with boundary condition Lu(x) = s(x); x 2 U ½ IRd (1) Bu(y) = 0; y 2 @U; (2) where L and B are linear differential operators. Question: What is a numerical solution of (1)-(2)? Answer: It is a function u¯ which satisfies (2) and makes the residual R := Lu¯ ¡ s small. 4 What do you mean by “small” ? Answer in the framework of Method of Weighted Residuals (MWR): Search for solutions u¯ in a finite-dimensional sub-space PN of some Hilbert space W (typically a L2 space). Expansion functions = trial functions : basis of PN : (Á0;:::;ÁN ) XN u¯ is expanded in terms of the trial functions: u¯(x) = u˜n Án(x) n=0 Test functions : family of functions (Â0;:::;ÂN ) to define the smallness of the residual R, by means of the Hilbert space scalar product: 8 n 2 f0;:::;Ng; (Ân;R) = 0 5 Various numerical methods Classification according to the trial functions Án: Finite difference: trial functions = overlapping local polynomials of low order Finite element: trial functions = local smooth functions (polynomial of fixed degree which are non-zero only on subdomains of U) Spectral methods : trial functions = global smooth functions (example: Fourier series) 6 Various spectral methods All spectral method: trial functions (Án) = complete family (basis) of smooth global functions Classification according to the test functions Ân: Galerkin method: test functions = trial functions: Ân = Án and each Án satisfy the boundary condition : BÁn(y) = 0 tau method: (Lanczos 1938) test functions = (most of) trial functions: Ân = Án but the Án do not satisfy the boundary conditions; the latter are enforced by an additional set of equations. collocation or pseudospectral method: test functions = delta functions at special points, called collocation points: Ân = ±(x ¡ xn). 7 Solving a PDE with a Galerkin method Let us return to Equation (1). Since Ân = Án, the smallness condition for the residual reads, for all n 2 f0;:::;Ng, (Án;R) = 0 () (Án;Lu¯ ¡ s) = 0 à ! XN () Án;L u˜k Ák ¡ (Án; s) = 0 k=0 XN () u˜k (Án; LÁk) ¡ (Án; s) = 0 k=0 XN () Lnk u˜k = (Án; s) ; (3) k=0 where Lnk denotes the matrix Lnk := (Án; LÁk). ! Solving for the linear system (3) leads to the (N + 1) coefficients u˜k of u¯ 8 Solving a PDE with a tau method Here again Ân = Án, but the Án’s do not satisfy the boundary condition: BÁn(y) 6= 0. Let (gp) be an orthonormal basis of M + 1 < N + 1 functions on the boundary @U and let us expand BÁn(y) upon it: XM BÁn(y) = bpn gp(y) p=0 The boundary condition (2) then becomes XN XM Bu(y) = 0 () u˜k bpk gp(y) = 0; k=0 p=0 hence the M + 1 conditions: XN bpk u˜k = 0 0 · p · M k=0 9 Solving a PDE with a tau method (cont’d) The system of linear equations for the N + 1 coefficients u˜n is then taken to be the N ¡ M first raws of the Galerkin system (3) plus the M + 1 equations above: XN Lnk u˜k = (Án; s) 0 · n · N ¡ M ¡ 1 k=0 XN bpk u˜k = 0 0 · p · M k=0 XN The solution (˜uk) of this system gives rise to a function u¯ = u˜k Ák such that k=0 XM Lu¯(x) = s(x) + ¿p ÁN¡M+p(x) p=0 10 Solving a PDE with a pseudospectral (collocation) method This time: Ân(x) = ±(x ¡ xn), where the (xn) constitute the collocation points. The smallness condition for the residual reads, for all n 2 f0;:::;Ng, (Ân;R) = 0 () (±(x ¡ xn);R) = 0 () R(xn) = 0 () Lu(xn) = s(xn) XN () LÁk (xn)˜uk = s(xn) (4) k=0 The boundary condition is imposed as in the tau method. One then drops M + 1 raws in the linear system (4) and solve the system XN LÁk(xn)u ˜k = s(xn) 0 · n · N ¡ M ¡ 1 k=0 XN bpk u˜k = 0 0 · p · M k=0 11 What choice for the trial functions Án ? Periodic problem : Án = trigonometric polynomials (Fourier series) Non-periodic problem : Án = orthogonal polynomials 12 2 Legendre and Chebyshev expansions 13 Legendre and Chebyshev polynomials Families of orthogonal polynomials on [¡1; 1] : Legendre polynomials: Z 1 2 Pm(x)Pn(x) dx = ±mn ¡1 2n + 1 Chebyshev polynomials: Z 1 dx Tm(x)Tn(x) p = 1 ¡ x2 ¡1 ¼ (1 + ± ) ± 2 0n mn [from Fornberg (1998)] 3 1 P (x) = 1, P (x) = x, P (x) = x2 ¡ T (x) = 1, T (x) = x, T (x) = 2x2 ¡ 1 0 1 2 2 2 0 1 2 Both Legendre and Chebyshev polynomials are a subclass of Jacobi polynomials 14 Properties of Chebyshev polynomials Definition: cos nθ = Tn(cos θ) Recurrence relation : Tn+1(x) = 2xTn(x) ¡ Tn¡1(x) Eigenfunctions of the singular Sturm-Liouville problem: µ ¶ p 2 d 2 dTn n 1 ¡ x = ¡p Tn(x) dx dx 1 ¡ x2 2 Orthogonal family in the Hilbert space Lw[¡1; 1], equiped with the weight w(x) = (1 ¡ x2)¡1=2 : Z 1 (f; g) := f(x) g(x) w(x) dx ¡1 15 Polynomial interpolation of functions Given a set of N + 1 nodes (xi)0·i·N in [¡1; 1], the Lagrangian interpolation of a function u(x) is defined by the N-th degree polynomial: XN YN µ ¶ x ¡ xj IN u(x) = u(xi) xi ¡ xj i=0 j=0 j6=i Cauchy theorem: there exists x0 2 [¡1; 1] such that 1 YN u(x) ¡ I u(x) = u(N+1)(x ) (x ¡ x ) N (N + 1)! 0 i i=0 YN Minimize u(x) ¡ IN u(x) independently of u () minimize (x ¡ xi) i=0 16 Chebyshev interpolation of functions YN N+1 N Note that (x ¡ xi) is a polynomial of degree N + 1 of the type x + aN x + ¢ ¢ ¢ i=0 (leading coefficient = 1). Characterization of Chebyshev polynomials: Among all the polynomials of degree n with leading coefficient 1, the unique polynomial which has the smallest maximum on n¡1 n¡1 [¡1; 1] is the n-th Chebyshev polynomial divided by 2 : Tn(x)=2 . =) take the nodes xi to be the N + 1 zeros of the Chebyshev polynomial TN+1(x) : YN 1 (x ¡ x ) = T (x) i 2N N+1 i=0 µ ¶ 2i + 1 x = ¡ cos ¼ 0 · i · N i 2(N + 1) 17 Spectral expansions : continuous (exact) coefficients 2 Case where the trial functions are orthogonal polynomials Án in Lw[¡1; 1] for some weight w(x) (e.g. Legendre (w(x) = 1) or Chebyshev (w(x) = (1 ¡ x2)¡1=2) polynomials). The spectral representation of any function u is its orthogonal projection on the space of polynomials of degree · N: XN PN u(x) = u˜nÁn(x) n=0 where the coefficients u˜n are given by the scalar product: Z 1 1 u˜n = (Án; u) with (Án; u) := Án(x) u(x) w(x) dx (5) (Án;Án) ¡1 The integral (5) cannot be computed exactly... 18 Spectral expansions : discrete coefficients The most precise way of numerically evaluating the integral (5) is given by Gauss integration : Z 1 XN f(x) w(x) dx = wi f(xi) (6) ¡1 i=0 where the xi’s are the N + 1 zeros of the polynomial ÁN+1 and the coefficients wi are XN Z 1 i i the solutions of the linear system xj wj = x w(x) dx. j=0 ¡1 Formula (6) is exact for any polynomial f(x) of degree · 2N + 1 Adaptation to include the boundaries of [¡1; 1] : x0 = ¡1; x1; : : : ; xN¡1; xN = 1 ) Gauss-Lobatto integration : xi = zeros of the polynomial P = ÁN+1 + ¸ÁN + ¹ÁN¡1, with ¸ and ¹ such that P (¡1) = P (1) = 0. Exact for any polynomial f(x) of degree · 2N ¡ 1. 19 Spectral expansions : discrete coefficients (con’t) Define the discrete coefficients uˆn to be the Gauss-Lobatto approximations of the integrals (5) giving the u˜n’s : 1 XN uˆ := w Á (x ) u(x ) (7) n (Á ;Á ) i n i i n n i=0 The actual numerical representation of a function u is then the polynomial formed from the discrete coefficients: XN IN u(x) := uˆnÁn(x) ; n=0 instead of the orthogonal projection PN u involving the u˜n. Note: if (Án) = Chebyshev polynomials, the coefficients (ˆun) can be computed by means of a FFT [i.e. in » N ln N operations instead of the » N 2 operations of the matrix product (7)]. 20 Aliasing error Proposition: IN u(x) is the interpolating polynomial of u through the N + 1 nodes (xi)0·i·N of the Gauss-Lobatto quadrature: IN u(xi) = u(xi) 0 · i · N On the contrary the orthogonal projection PN u does not necessarily pass through the points (xi). The difference between IN u and PN u, i.e. between the coefficients uˆn and u˜n, is called the aliasing error.

View Full Text

Details

  • File Type
    pdf
  • Upload Time
    -
  • Content Languages
    English
  • Upload User
    Anonymous/Not logged-in
  • File Pages
    48 Page
  • File Size
    -

Download

Channel Download Status
Express Download Enable

Copyright

We respect the copyrights and intellectual property rights of all users. All uploaded documents are either original works of the uploader or authorized works of the rightful owners.

  • Not to be reproduced or distributed without explicit permission.
  • Not used for commercial purposes outside of approved use cases.
  • Not used to infringe on the rights of the original creators.
  • If you believe any content infringes your copyright, please contact us immediately.

Support

For help with questions, suggestions, or problems, please contact us