# How can I prove numerical diffusion in upwind scheme for transport equation

I was just implementing the upwind scheme for a linear transport equation $u_t + cu_x = 0$ where $c=0.5$ and I saw that the solution was indeed advected but over time it starts to diffuse. Can anyone provide some references to understand where does it comes from?

Numerical diffusion arises from a first-order finite difference approximation to the spatial derivative $\partial u/\partial x$. To see how this is the case, examine the Taylor series expansion for $u_{i+1}$:

$$u(x_{i+1}) = u(x_{i}) + \left.\frac{\partial u}{\partial x}\right|_{x_i} (\Delta x) + \frac{1}{2} \left. \frac{\partial^2 u}{\partial x^2}\right|_{x_i} (\Delta x)^2 + (\text{Higher order terms})$$

Thus, the first derivative can be written as

$$\frac{\partial u}{\partial x} =\frac{u(x_{i+1}) - u(x_{i})}{\Delta x} - \frac{1}{2}\frac{\partial^2u}{\partial x^2}(\Delta x) - \frac{1}{\Delta x}(\text{Higher order terms})$$

Typically, everything following the first term on the right hand side is truncated when approximating the derivative, but that doesn't mean that it doesn't exist. We can now re-write the original PDE, replacing the exact spatial derivative with the new upwind approximation and moving the truncated terms over to the right hand side.

$$\frac{\partial u}{\partial t} + c\left( \frac{u(x_{i+1}) - u(x_{i})}{\Delta x}\right) = c\left(\frac{\Delta x}{2}\frac{\partial^2 u}{\partial x^2} + \frac{1}{\Delta x}(\text{Higher order terms})\right)$$

Now, note that the "Higher order terms" are much smaller than the second derivative on the right hand side, so they can be ignored. Therefore, your original diffusion-free PDE has been transformed into a convection-diffusion PDE due to truncation error.

$$\frac{\partial u}{\partial t} + c\left( \frac{u(x_{i+1}) - u(x_{i})}{\Delta x}\right) = D\frac{\partial^2 u}{\partial x^2}$$

where $D$ is the diffusion coefficient due to numerical diffusion.

Although this equation does not have diffusion, the numerical algorithm for solving the advection equation inherently has a certain diffusion. In fact, there is no numerical method without numerical diffusion. Some algorithms have more numerical diffusion, some less, and there are methods to constrain the spread of discontinuities. But in principle, the numerical diffusion is inevitable. One way to see this, is to do the following exercise: 