Math 660-Lecture 15: Spectral Methods: Fourier Pseduo-Spectral Method

Math 660-Lecture 15: Spectral Methods: Fourier Pseduo-Spectral Method

Math 660-Lecture 15: Spectral methods: Fourier pseduo-spectral method The topics here will be in the book `Spectral methods in Matlab' (Chap- ter 3); Another reference book is `Spectral methods in chemistry and physics.' 1 Spectral methods v.s. pseudo-spectral methods 1.1 Spectral method A spectral method is to represent the solution of a differential equation in terms of a basis of some vector space and then reduce the differential equations to an ODE system for the coefficients. In this sense, the (contin- uous) Fourier Transform and the Finite Element methods are all spectral methods. In particular, suppose we have some equation T (u) = f(x) where T is some temporal-spatial operator for the differential equation. Then, under the basis we have the error: X X R(x) = T ( ci(t)φi(x)) − f~iφi i i Pick test functions fχjg, which is the dual basis of fφi(x)g (if the space is a Hilbert space like in FEM, these two are identical) and we require hχj;Ri = 0: This then gives a system of equations for cj. • Advantages: Reduce differential operators to multiplications, and solv- ing ODEs might be easier. • Disadvatange: The multiplication in the spatial variable becomes con- volution. Then, we may have a big matrix-vector multiplication. 1.2 Pseudo-spectral method Here, represent the solution in terms of the basis but impose the equa- tion only at discrete points. As we can see, the pseudo-spectral method in some sense is a spectral method in discrete space. There are some typical pseudo-spectral methods 1 • Fourier Pseudo-spectral method with trigonometric basis • Chebyshev pseudo-spectral method with Chebyshev polynomial basis • Collocation methods with polynomial basis (especially for ODEs solvers); (Some people also call the pseudo-spectral method the collocation method.) For discrete points, we often choose χj = δ(x − xj), so that we require R(xj) = 0: The pseudo-spectral method may have efficient algorithms, which makes solving PDEs fast. For example, to compute a(x)ux(x; t), using spectral method where x is continuous, we have an infinite convolution. Even if we truncate, we have a matrix multiplied with a vector. However, if we use the Fourier pseudo-spectral method, we can make use of the FFT and IFFT to change the function back into x space and perform the multiplication in x space. This will save a lot of time. In this course, we will only cover Fourier pseudo-spectral method. You can read the Chebyshev yourself, which is also useful. 2 Basic theories for Discrete Fourier Transform (DFT) Consider N (an even number) points v1; v2; : : : ; vN . We define the DFT as N X −ikxn v^k = e vn; k 2 Z n=1 2π where xn = N n. This means that we regard v as a function on (0; 2π] and xn is a sample point on the interval. • Note that the definition here is a little different from the book. We use this because it's more common. Also in Matlab, the summation is PN −ikxn−1 n=1 e vn, which will not cause a trouble, since we can imagine that we are doing a shifted sequence or vn is associated with xn−1 instead of xn. PN−1 −ikxn • Other people also use the definition as n=0 e vn. Of course, this is equivalent to ours if we regard xN as x0. 2 • Different definitions (shifting the sequence) may result in a uniform factor phase for the DFT. However, as long as we have consistent inverse formula, it is just fine. Properties • v^k =v ^k+mN . In Matlab, the output is for k = 0; 1; 2;:::;N − 1 or k = 0; 1; 2; : : : ; N=2; −N=2 + 1;:::; −1. In other words, fft(v) gives a vector w such that w(1) =v ^0; : : : ; w(N) =v ^N−1. ¯ • If v is real valued, thenv ^k = v^−k, where the bar means complex conjugate. If follows thatv ^N=2 is real. • Define the discrete convolution: N X wn = (u ∗ v)n = ujvn−j j=1 where vn−j = vN+n−j if n − j < 0. Then, w^k =u ^kv^k: • The discrete Parseval equality holds: N=2 X 1 X u v = u^ v^ n n N k k n k=−N=2+1 Let us prove the last two. Proof. For the discrete convolution, we have N N N N X −ikxn X X −ikxj X −ik(xn−xj ) w^k = e ujvn−j = uje e vn−j n=1 j=1 j=1 n=1 By the cyclic symmetry, we have the result. We have N=2 X X X −ikxm X ikxn X X ik(xn−xm) u^kv^k = ( ume )( vne ) = umvn e k=−N=2+1 k m n m;n k P The sum on the right hand side is Nδm;n, so we have N n unvn. 3 Remark 1. Some people want to define N 1 X v^ = e−ikxn v ; k N n n=1 then the Parseval is N=2 2π X X ( ) u v = 2π u^ v^ N n n k k n k=−N=2+1 Inverse DFT The inverse DFT is given by N−1 N=2 1 X 1 X v = eikxn v^ = eikxn v^ : n N k N k k=0 k=−N=2+1 1 PN−1 ikxn−1 (In Matlab convention, we should have vn = N k=0 e v^k, as vn is associated with xn−1.) Proof. First of all, e−ik(xn−xj ) = e−ikxn−j , X X −ikxn X X −ikxn w^k = ujvn−je = uj vn−je n j j n X −ikxj X −ikxn−j X −ikxj = uje vn−je = uje v^k =u ^kv^k: j n j For the second, N−1 N−1 1 X 1 X X 1 X X eikxn v^ = eikxn v e−ikxm = v eik(xn−xm) N k N m N m k=0 k=0 m m k P ik(xn−xm) P ik(n−m)h Clearly, k e = k e . If n = m, the sum is N. If n 6= m, the sum equals zero by the geometric sum since [eik(n−m)h]N = 1. Hence, 1 X X 1 X v eik(xn−xm) = v Nδ = v : N m N m n−m n m k m 4 3 FFT: fast algorithms to compute DFT The most frequently used one is the Cooley-Tukey algorithm (the algo- rithm was independently discovered also by Gauss). The idea is based on the simple fact. Let N be even, then N N=2 N=2 X −ikn 2π X −ikm 2π ik 2π X −ikm 2π une N = u2me (N=2) + e N u2m−1e (N=2) n=1 m=1 m=1 The DFT of an array of size N is reduced to 2 DFT of arrays with size N=2 plus extra N operations. By this way, the whole complexity is O(N log N). 4 Fourier Differentiation For general x, we can define a function N=2 1 X f(x) = eikxv^ ; N k k=−N=2+1 (m) (m) and then we use f (xj) to approximate the derivatives v (xj). 4.1 Algorithm for Fourier differentiation The above idea generates the following Fourier differentiation: • Given v = (v1; : : : ; vN ), computev ^. m • Definew ^k = (ik) v^k, for k = −N=2+1; : : : ; N=2 (or k = 0; : : : ; N=2; −N=2+ 1;:::; −1 in Matlab.) • Compute the inverse DFT (inverse FFT) and get wk, the real part of which is the approximation of the derivative. we take real part because numerical error may introduce some complex val- ues. Corollary 1. For the Fourier differentiation, without taking the real part, the discrete integration by parts by Fourier differentiation holds. This is a corollary of the Paserval equality. 1 PN−1 ikx Exercise: Will it matter if we use f(x) = N k=0 e v^k to compute the derivatives? If it matters, which one is better? Choose a periodic smooth 5 function and code up to check out. Can you explain this? (Hint: Use the Aliasing formula in the next lecture.) However, the k = N=2 mode is a little bit strange. Assume v is a real array. Then, v^N=2 = v^−N=2 = v^N=2: This meansv ^N=2 is real. This mode will contribute derivative iN i N x v^ e 2 j N=2 2 Clearly, this part is imaginary at the given grid points. 6.

View Full Text

Details

  • File Type
    pdf
  • Upload Time
    -
  • Content Languages
    English
  • Upload User
    Anonymous/Not logged-in
  • File Pages
    6 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