Assignment 5: Partial Differential Equations
For this assignment, you will simulate the KPP-Fisher's equation:
$$\frac{\partial u}{\partial t} - \frac{\partial^2u}{\partial x^2} = u (1-u) $$
This is a diffusion equation with a non-linear reaction term.
Let the \(x\) values be restricted to the interval [0,\(L\)], and the boundary values be such that \(u(0,t)=A \sin^2(t)\) and \(u(L,t)=0\) (for all \(t\)).
The initial value is given by \(u(x,0) = 0\).
The solution should be numerically computed with an explicit time-stepping scheme using timesteps \(\Delta t\) upto a time \(T\) and using a discretization of the interval into \(N\) points. Forward Euler will suffice here. As we saw in class, this will involve linear algebra.
During the simulation, we want \(P\) snapshots of the value of \(u\) on these \(N\) points to be printed to screen. The format of the output should be such that each line contains three numbers separated by spaces, i.e., the time, position, and value of \(u\) at that time and position.
\(P, L,A,N,T\), and \(\Delta t\) should be input parameters of your code. Focus on the case \(L=5\), \(A=0.2\), \(N=100\), \(T=10\) and \(P=400\) in particular and choose \(\Delta t\) such that the method is numerically stable.
For this assignment, you should in fact write 3 codes.
1) using a full matrix and an explicit triple loop for the matrix-vector multiplication
2) using a full matrix and a call to a BLAS routine from either openblas or mkl for the matrix-vector manipulation.
3) using only the non-zero elements of the matrix.
Use the rarray library for your all vectors and matrices.
As usual, use comments, git, and make. The codes should be able to run on the Teach cluster if the gcc and rarray modules are loaded, as well as openblas or mkl. Modularity is not a requirement in this assignment, but a couple of functions are expected. Submit your repo as a zip file.