Chapter 7 The Finite Fourier Transform (FFT) Method 7.1 Introduction The FFT method is one of many analytical or numerical techniques in which exact or approximate solutions to partial differential equations are found by expanding the solution in terms of a set of known functions, called basis functions, and then determining the unknown coefficients in the expansion. Applying the FFT method to partial differential equations like u 2u 2u = c2 + t x 2 y 2 ( ) + E(x, y) reduces the number of spatial variables until only a two-point boundary-value problem or initial-value problem remains, which is solved by standard methods. The FFT method is basically equivalent to the technique of separation of variables, however the FFT method is more flexible and permits a more direct attack on many problems. The FFT method is applicable to linear boundary-value problems in domains where at least one of the spatial dimensions is finite. Let = (r, t) be the field variable (e.g., temperature or concentration), and let L be a differential operator which contains one or more spatial derivatives and perhaps also a time derivative. Then, a wide variety of partial differential equations can be represented as L = S(r) where S(r) is a specified function of position. The differential operator is said to be linear if L(a11 + a22) = a1L1 + a2L2 where a1 and a2 are any constants and 1(r, t) and 2(r, t) are any functions [not necessarily solutions of L = S(r)]. Aside from the requirement of linearity, the other restriction of the FFT method is that the boundaries must correspond to constant values of the coordinates, or coordinate surfaces. Consider the following PDE 2 2 + =0 x 2 y 2 with the boundary conditions (0, y) = 0, (1, y) = 0 7-1 (x, 0) = f0(x), (x, 1) = f1(x) The solution can be written in a series expansion as (x, y) = C ( y ) n 1 n n ( x) , In this equation n(x) are given by: n(x) = 2 sin(nx), n = 1, 2, … Table 7-1. Basis Functions for Certain Eigenvalue Problems in Rectangular Coordinates Case Boundary conditions Basis functions I (0) = 0, (L) = 0 nx 2 n(x) = sin , n = 1, 2, ... L L 1 nx 2 II ’(0) = 0, (L) = 0 n(x) = cos n , n = 1, 2, ... 2 L L III (0) = 0, ’(L) = 0 IV ’(0) = 0, ’(L) = 0 1 nx 2 sin n , n = 1, 2, ... 2 L L nx 2 1 cos , n = 1, 2, ...; 0(x) = L L L n(x) = n(x) = The functions n(x) are called the basis functions. The factor 2 has the effect of normalizing the basis functions. For rectangular coordinates the basis functions are given in Table 7-1. Set of functions that can be used as basis functions in the FFT method are the eigenfunctions. In terms of the independent variable x, the eigenfunctions are solutions to the differential equation d 2 = 2 2 dx (7.1-4) The boundary conditions for eigenvalue problems must be of certain type. Thus, the boundary conditions for Eq. (7.1-4) are usually some combination of = 0, (7.1-5a) ’ = 0, (7.1-5b) ’ + A=0, (7.1-5b) where primes are used to denote differentiation with respect to x and A is a constant. 7-2 Eq. (7.1-4) is a Sturm-Liouville equation d dx dy p( x ) dx + [q(x) + r(x)]y = 0 with p(x) = 1, q(x) = 0, and r(x) = 1, and = 2 . Sturm-Liouville equation with real eigenvalues yields solutions that are orthogonal functions with the weighting function r(x). The basis functions n(r) in cylindrical coordinates are Bessel functions that are solutions of 1 d d r = 2 r dr dr (7.1-6) Eq. (7.1-6) is a Sturm-Liouville equation with p(x) = r(x) = r and q(x) = 0. For problems involving annular regions, such that a r b, orthogonal functions results when any of the three types of boundary conditions from Eq. (7.1-5) are applied at r = a and r = b. For domains containing the origin, all that is required at r = 0 is that and ’ be finite. The basis functions n(r) in spherical coordinates are solutions of 1 d 2 d r = 2 r 2 dr dr (7.1-7) This is Sturm-Liouville equation with p(x) = r(x) = r2 and q(x) = 0. The solution to Eq. (7.17) is expressible as (r) = a cos r sin r +b , r r where a and b are constants. The basis functions n() in spherical coordinates can also be solutions of d d 1 2 = 2 d d (7.1-8) This is Legendre’s equation which is also a Sturm-Liouville equation with p(x) = (1 2), r(x) = 1 and q(x) = 0. Eq. (7.1-8) has only one solution which is bounded at = 1, namely n() = anPn() where the function Pn() are Legendre polynomials. The eigenvalues must be given by n2 = n(n + 1) (7.1-9) 7-3 The other linearly independent solution of Eq. (7.1-8), which is not bounded at = 1, involves what are called Legendre polynomials of the second kind; that solution is of no physical interest and will be disregarded. The Legendre polynomials Pn(x) are orthogonal on the interval [-1, 1] with respect to the weighting function r(x) = 1. The first two Legendre polynomials are P0(x) = 1 and P1(x) = x, and the remaining members of this orthogonal sequence can be generated using the recursion relation, ( 2n 1) Pn x nPn 1 ( x ) n 1 Pn+1(x) = We will show an introductory FFT example to illustrate the mechanics of the method. Many other important considerations relating to how and why the method works will be discussed in later sections. Example 7.1-1. ---------------------------------------------------------------------------------Solve the Laplace’s equation 2u 2u 2 2 = 0 y x with the following boundary conditions u(0,y) = 0, u(1,y) = 0, 0<y<1 u(x,0) = f0(x), u(x,1) = f1(x), 0 < x < 1 top surface y u=f1(x) b 2 u=0 u=0 u=f0(x) 0 u=0 a bottom surface x Solution -----------------------------------------------------------------------------------------Assume that the solution can be written in a series expansion as u(x,y) = C ( y ) n 1 n n ( x) (7.1-10) 7-4 In this equation, n(x) are the basis functions that can be obtained from Table 7-1 n(x) = n = 1, 2, … 2 sin(nx) , Each term in equation (7.1-10) is a product of two functions, each involving only one spatial variable. This feature is similar to the method of separation of variables. The basis functions n(x) are chosen so that the boundary conditions at x = 0 and x = 1 are satisfied. The factor 2 has the effect of normalizing the basis functions; the advantage of doing this will be clear once the final solutions are obtained. We now need to determine the coefficients Cn(y) that multiply the basis functions. For this problem, the finite Fourier transform (FFT) of the temperature is defined as n(y) = 1 0 n (x ) u(x,y)dx (7.1-11) In this equation n(y) is defined as the transformed temperature. It is an integral transform in which the original function is multiplied by a kernel or basis function, and the result integrated over the finite interval 0 x 1. The limits of integration correspond to the range of x in the problem; these limits will be modified for different boundary conditions of x. It will be shown that n(y) is identical to the expansion coefficient Cn(y), so that knowing n(y) for all n is sufficient to solve the problem. The function n(y) may be obtained by applying the FFT to both sides of the Laplace equation 2u 2u 0 n (x) x 2 y 2 dx = 0 1 (7.1-12) The second term on the left side of this equation is written as 1 n (x) 0 2u d2 dx = y 2 dy 2 1 n (x) u(x,y)dx = 0 d 2 n dy 2 (7.1-13) The first term on the left side of equation (7.1-12) is rearranged using integration by parts d(wv) = wdv + vdw wdv = d (wv) vdw wdv = wv vdw Let w = n(x) dv = d n dw = dx dx u 2u dx v = 2 x x 7-5 2u u (x ) 0 n x 2 dx = n(x) x 0 1 1 d n u dx 0 dx x 1 Applying the integration by parts again yields d 2u u (x ) 0 n x 2 dx = n(x) x 0 dxn u 0 + 1 1 1 d 2 n 0 dx 2 udx 1 From the boundary conditions n(x = 0) = n(x = 1) = 0 and u(0,y) = u(1,y) = 0 d n u Therefore n(x) = 0 and u = 0. From the basis functions x 0 dx 0 1 1 n(x) = 2 sin(nx) , d n d 2 n = n 2 cos(nx) = (n)2 2 sin(nx) = (n)2n(x) dx dx 2 The first term on the left side of equation (7.1-12) becomes 2u 0 n (x) x 2 dx = 1 1 n (x) 0 1 d 2 n 2 udx = (n) 0 dx 2 0 n (x) u(x,y)dx 1 2u dx = (n)2n(y) 2 x (7.1-14) Substituting equations (7.1-13) and (7.1-14) into equation (7.1-12) gives 1 1 2u 2u 2u 2u 0 n (x) x 2 y 2 dx = 0 n (x) y 2 dx + 0 n (x) x 2 dx = 0 1 d 2 n (n)2n(y) = 0 2 dy (7.1-15) The above equation requires two boundary conditions, which are obtained by transforming the original boundary conditions involving y. From the definition of the FFT n(y) = 1 0 n (x ) u(x,y)dx 7-6 We have n(0) = n(1) = 1 1 0 0 1 1 0 0 n (x) u(x,0)dx = n (x) f0(x)dx = An n (x) u(x,1)dx = n (x) f1(x)dx = Bn The solution of the equation (7.1-15) is expressed in terms of the hyperbolic functions since the domain of y is finite n(y) = D1cosh(ny) + D2sinh(ny) The two constants of integration D1 and D2 are obtained from the boundary conditions y = 0, n(0) = D1 = An y = 0, n(1) = Bn = Ancosh(n) + D2sinh(n) D2 = Bn An cosh( n ) sinh( n ) n(y) = Ancosh(ny) + Bn An cosh( n ) sinh(ny) sinh( n ) n(y) = An [cosh( ny ) sinh( n ) cosh( n ) sinh( ny )] Bn sinh( ny ) sinh( n ) n(y) = An sinh[ n (1 y )] Bn sinh( ny ) sinh( n ) We now need to show that the expansion coefficient Cn(y) is just the finite Fourier transformed of the temperature n(y). From the assume expansion u(x,y) = C ( y ) n 1 n n ( x) We can take the FFT of this equation 1 m(y) = m (x) u(x,y)dx = 0 C n 1 1 n ( y ) m ( x ) n ( x ) dx 0 The integral involving the product of the basis functions can be evaluated 7-7 1 1 0 0 Let I = m ( x ) n ( x ) dx = 2 sin( mx ) sin( nx ) dx From the trigonometric identity: sin x sin y = 1 [ cos(x+y) + cos(xy)], we have 2 1 I = { cos[( m n)x] cos[(( m n)x]} dx 0 Therefore I = 0 when m n and I = 1 when m = n. The relation can be written as I = mn 0 when m n The Kronecker delta mn is defined as mn = 1 when m n Hence n(y) = Cn(y) and the final solution is u(x,y) = C ( y ) n n 1 u(x,y) = 2 n 1 n ( x) An sinh[ n (1 y )] Bn sinh( ny ) sin(nx) sinh( n ) Notice that the 2 factor included in the basis function n(x) was needed to make m(y) and Cn(y) identical. If the basis functions has not been normalized in this manner we would obtain the relation n(y) = 0.5 Cn(y). Summary The FFT method first transforms the PDE into an ODE using the definition n(y) = 1 0 n (x ) u(x,y)dx The ODE was solved using elementary method to obtain n(y), which is the same as Cn(y). The solution is then u(x,y) = C ( y ) n 1 n n ( x) In this equation n(x) is the known basic function. 7-8 For a numerical example, let u(x,0) = f0(x) = sin(x), and u(x,1) = f1(x) = sin(x). The solution is u(x,y) = 2 n 1 An sinh[ n (1 y )] Bn sinh( ny ) sin(nx) sinh( n ) The coefficients are given by 1 An = n (x ) u(x,0)dx = 1 0 1 1 Bn = n (x ) u(x,1)dx = 0 0 0 n (x ) f0(x)dx n (x ) f1(x)dx Hence An = Bn = 1 0 2 sin( nx ) sin(x)dx = 2 2 1 [cos( n 1)x cos(n 1)x]dx 0 1 2 1 1 sin( n 1)x sin( n 1)x = 0 for n > 1 An = n 1 2 n 1 0 For n = 1, A1 = A1 = 1 0 2 2 1 2 sin 2 (x ) dx 2 sin( x) sin(x)dx = 0 2 2 1 [1 cos(2x)] dx = 0 The solution for this particular case is simply u(x,y) = sinh[ (1 y )] sinh( y ) sin(x) sinh( ) (7.1-16) The solution surface is plotted in Figure 7.1-1 using the following Matlab statements. --------------------------------------% Example 7.1-1 % [X,Y]=meshgrid(0:.02:1); n1=length(X); uxy=(sinh(pi*(1-Y))+sinh(pi*Y)).*sin(pi*X)/sinh(pi); mesh(X,Y,uxy) --------------------------------------Figure 7.1-2 shows the results obtained from Matlab pdetool. 7-9 1 0.8 0.6 0.4 0.2 0 1 0.8 1 0.6 0.8 0.6 0.4 0.4 0.2 0.2 0 0 Figure 7.1-1 Solution surface for equation 7.1-16 (example 7.1-1). Color: u Height: u 0.9 1 0.8 0.7 0.6 0.5 0.5 0.4 0.3 0 1 0.2 0.8 1 0.6 0.8 0.6 0.4 0.1 0.4 0.2 0.2 0 0 Figure 7.1-2 Solution surface for equation 7.1-16 using pdetool. 7-10 0