Assignment 6: PDE with Fourier Transform
For this assignment, we once more look at the KPP-Fisher equation:
$$\frac{\partial u}{\partial t} - \frac{\partial^2u}{\partial x^2} = u (1-u) $$
but now with periodic boundary conditions \(u(0,t)=u(L,t)\) and the following an initial condition:
$$ u(x,0) = A \left[ \sin\left(\frac{\pi x}{L}\right) \right]^{100}. $$
The solution method to be used in this assignment is quite different from that of the previous assignment. Each time step, we split the dynamics in a reaction substep and a diffusion substep. The reaction substep omits the diffusion part, i.e., it solves
$$\frac{\partial u}{\partial t} = u (1-u) $$
over a time interval \(\Delta t\). The exact solution for this substep is
$$u(x,t+\Delta t)=\frac{u(x,t)}{u(x,t) + [1-u(x,t)]\exp(-\Delta t)}$$
for each \(x\) separately.
For the diffusion time step, we solve the equation neglecting the non-linear reaction part:
$$\frac{\partial u}{\partial t} = \frac{\partial^2u}{\partial x^2} $$
which we can solve in the Fourier domain, i.e., we compute \(\hat u\) using a fast Fourier transform (from the FFTW library), and then need to solve
$$\frac{\partial \hat u}{\partial t} = -k^2 \hat u$$
which is solved by
$$\hat u(k,t+\Delta t) = \hat u(k,t)\exp(-k^2\Delta t)$$
for each \(k\) separately. Remember that \(k=2\pi q/L\) in the discrete case, with \(-N/2 \leq q < N/2\). Finally, the inverse Fourier transform should be taken.
The smaller \(\Delta t\) is, the more accurate the alternation of a diffusion and reaction step would approximate the solution of the full equation.
Note that the Fourier transform needed in the diffusion substep is from a real vector, \(u\), to a complex vector, \(\hat u\). The FFTW library has specialized routines for that; please look them up in its documentation.
The output should be in the same format as in assignment 5, but focussing on the parameters \(L=5\), \(A=1\), \(N=100\), \(T=10\) and \(P=400\) and choose \(\Delta t = 0.01\).
As always, we expect you to use the rarray library for your all vectors, use git and make, and use sensible comments. The code can be a single file which should be able to run on the Teach cluster if the gcc, rarray and fftw modules are loaded. Submit your repo as a zip file. Including the working tree in that zip file is encouraged.