Nonlinear Implicit Finite Difference How do you produce an implicit finite difference system with a nonlinear term in the pde?
For example, if you have the reaction-diffusion equation:
$$\frac{\partial{u}}{\partial{t}} = \Delta u + f(u)$$
with $f$ being non-linear, e.g. $f(u) = u^2$, how do you form a finite difference system to solve?
I understand how to derive if $f(u)=0$. For example in a 1D setting, you have the form:
$$w_{i}^{n-1} = (1+2\lambda)w_{i}^n - \lambda(w_{i+1}^n + w_{i-1}^n)$$
producing a system in the form:
$$Aw^n=w^{n-1}$$
 A: In this case, a common approach is make the nonlinear part explicit. You start with the initial condition $u^{(0)}$ and , for each $k\ge 0$, solve a linear problem. The following example uses a simple forward difference for the time derivative, but you can replace it for something fancier.
$$
\frac{u^{(k+1)}- u^{(k)}}{\delta t} = \Delta u^{(k+1)}+f(u^{(k)})
$$
or, equivalently,
$$
-\Delta u^{(k+1)}+\frac{1}{\delta t} u^{(k+1)} = \frac{1}{\delta t} u^{(k)}+f(u^{(k)})
$$
A: If you plan to use the so-called "Method of Lines", i.e. first you discretize in space (in this case you obtain the classical $[1, -2, 1]$ stencil) and then in time, then you obtain a (large) stiff system of ODEs of the form $$u_h' = Au_h + f(u_h)$$ where $u_h$ is the unknown vector, still continuous in time: $(u_h(t))_i=u(x_i,t)=u(x_0 + ih, t)$
Depending on how the time integration is performed, you may end up with an implicit scheme: the simplest is Backward Euler
$$u_h^{n+1} = u_h^{n} + kA u_h^{n+1} + f(u_h^{n+1})$$ which requires you to solve at each time step a non linear system of equations and it's generally expensive. Usually is $f(u)$ is non-linear, like your case, one may prefer to use an IMEX approach (IMplicit-EXplicit) and make explicit the nonlinearity $f(u)$ like @PierreCarre wrote in his answer. The advantage is that all you need to do now is to solve a linear system for each time step, which is fairly cheaper: $$u_h^{n+1} = (I-kA)^{-1}(u_h^n+f(u_h^n))$$
