# Solving PDEs with fourier methods#

Mathematics for Scientists and Engineers 2

We can use the properties of Fourier Transforms to solve PDEs (check Fourier Transforms notebook). The PDE will be Fourier transformed from the outset and due to the differentiation properties of Fourier Transforms this will lead to an ODE which is much easier to solve. It should also be noted that the FT method works best for infinite systems. Applying it to a finite system essentially reduces the problem into a Fourier series of modes with discrete wavelengths, rather than $$k$$ being continuous. For inhomogeneous boundary conditions, the FT usually yields a half-range Fourier series.

## Diffusion equation in 1D#

We will apply the FT method on the (linear) diffusion equation for an infinite system

$\frac{\partial u}{\partial t} = D \frac{\partial^2 u}{\partial x^2}$

where the diffusion coefficient $$D$$ is assumed to be independent of position. Firstly we FT the PDE and convert it to an ODE. To Fourier Transform the PDE we do

$\mathcal{F} \left[ \frac{1}{D} \frac{\partial u}{\partial t} \right] = \mathcal{F} \left[ \frac{\partial^2 u}{\partial x^2} \right]$

On the LHS, the time derivative can be pulled outside the integral over $$x$$ that performs the FT and using the differentiation property of Fourier Transforms on the RHS we get

$\frac{1}{D} \frac{\partial \tilde{u}(k, t)}{\partial t} = (ik)^2 \tilde{u} (k, t)$

Fortunately, in this case, the evolution of $$\tilde{u}(k, t)$$ at a particular value of $$k$$ does not depend on $$\tilde{u}$$ at a different value of $$k$$ and thus, the Fourier modes are uncoupled and evolve independently. Thus, we can regard $$k$$ as a parameter and $$\partial / \partial t$$ behaves the same as $$d/dt$$, which yields the ODE

$\frac{d ln(\tilde{u})}{dt} = - k^2 D$

where we have noted that $$d(ln(\tilde{u})) = d\tilde{u} \, / \, \tilde{u}$$.

The solution to the ODE is $$ln(\tilde{u}(k, t)) = - k^2 Dt + \text{constant}$$. Hence we can write

$\tilde{u}(k, t) = \tilde{u}_0(k) e^{-Dk^2t}$

where $$\tilde{u}_0(k) = \tilde{u}(k, t=0)$$ is the initial spectrum of Fourier modes and is determined by the initial conditions. To obtain the general solution we just take the inverse Fourier transform of the time-dependent spectrum:

$u(x,t) = \mathcal{F}^{-1} [\tilde{u}(k,t)] = \frac{1}{2\pi} \int_{-\infty}^{\infty} \tilde{u}_0(k) e^{ikx - Dk^2t} dk$

To obtain the initial spectrum by Fourier transforming the initial profile $$u_0(x) = u(x, t=0)$$:

$\tilde{u}_0(k) = \mathcal{F} [u_0(x)]$

### Example - $$\delta$$ function#

We will consider a $$\delta$$ function (infinitely narrow) initial profile for the diffusion equation and determine the particular solution of the problem. Thus the initial profile is given by

$u(x, t=0) = \delta(x)$

Thus we can determine the corresponding initial spectrum of Fourier modes:

$\tilde{u}_0(k) = \mathcal{F} [u_0(x)] = \mathcal{F} [\delta(x)] = 1$

Inserting this in the general solution, we get

$u(x,t) = \frac{1}{2\pi} \int_{-\infty}^{\infty} e^{ikx - Dk^2t} dk$
$\therefore \ \ \ \ u(x,t) = \frac{1}{\sqrt{4\pi Dt}} \ \ exp \left(- \frac{x^2}{4Dt} \right)$

which is the particular solution to the $$\delta$$ function initial profile.