How to use the finite difference method to solve a transport equation with a source term?

819 Views Asked by At

I am going to use the finite difference method to solve a transport equation with a source term. In order to solve $u_t+u_x=0$, we can use

$$u_j^{n+1}=u_j^n-\lambda (u_{j+1}^n-u_{j}^n)$$ where $\lambda=\frac{dt}{dx}$,

My question relates to the equation: $u_t+u_x=ku$, where $k$ is a constant. Is it correct to do the following to solve the equation above which includes the source term?

$$u_j^{n+1}=(1+k)u_j^n-\lambda(u_{j+1}^n-u_{j}^n)$$

1

There are 1 best solutions below

1
On BEST ANSWER

Your notation is messy.

What you are trying to do is: Solve $u_t + u_x = ku$. Let $u_j^n = u(x_j,t_n)$

Approx $u_{x}(x_j)= \frac{u_{j+1} - u_{j}}{\Delta{x}}$

We now have:

$u_t(x_j,t_n) \approx ku_j^n + \frac{1}{\Delta{x}} (u_{j+1}^n - u_j^n)$

Using (for example) Euler forward method:

$u_j^{n+1} = u_j^n + \Delta{t}(ku_j^n + \frac{1}{\Delta{x}} (u_{j+1}^n - u_j^n))$