Finite difference method of the heat equation with an additional functional term

350 Views Asked by At

I understand how to write the heat equation:

$\frac{\partial u}{dt}=c\frac{\partial ^2u}{\partial x^2}$

in numerical finite difference form implicitly (see wiki):

$\frac{u_{j}^{n+1} - u_{j}^{n}}{k} =c\frac{u_{j+1}^{n+1} - 2u_{j}^{n+1} + u_{j-1}^{n+1}}{h^2}$

However, if we were to include an additional term such that the wave equation becomes:

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

Would this extra term also be centred around the next time-step, such that it becomes $u_{j}^{n+1}$ rather than $u_{j}^{n}$ using the implicit finite difference method. If so, why?

1

There are 1 best solutions below

0
On BEST ANSWER

That depends basically whether you user Forward or Backward Euler. The discretization

$$\frac{u_{j}^{n+1} - u_{j}^{n}}{k} =c\frac{u_{j+1}^{n+1} - 2u_{j}^{n+1} + u_{j-1}^{n+1}}{h^2}$$

corresponds to Backward Euler since you evaluate the RHS at the next timestep $ n \color{red}{+1}$. Thus, the consistent adaptation for $\partial_t u = c \partial_{xx} u + u$ would be indeed

$$\frac{u_{j}^{n+1} - u_{j}^{n}}{k} =c\frac{u_{j+1}^{n+1} - 2u_{j}^{n+1} + u_{j-1}^{n+1}}{h^2} + u_j^ {n \color{red}{+1}}.$$

If you use Forward Euler instead, you get

$$\frac{u_{j}^{n+1} - u_{j}^{n}}{k} =c\frac{u_{j+1}^{\color{red}n} - 2u_{j}^{\color{red}n} + u_{j-1}^{\color{red}n}}{h^2} + u_j^ {\color{red}n }.$$