I have the following one-dimensional advection equation:
$\frac{\partial u}{\partial t}+c\cdot\frac{\partial u}{\partial x}=0$
and I would like to discretise this equation after time and space (either one of them or both) based on finite difference using the upwind scheme in first order.
So from Taylor series follows:
$f(x+\Delta x)=f(x)+\Delta x\frac{f'(x)}{1}+\ldots$
$\Rightarrow f'(x)=\frac{f(x+\Delta x)-f(x)}{\Delta x}+\mathcal{O}(\Delta x)$
How could I now exactly derive the time and space (time, space, time + space) discretization (so the numerical equation) of the one-dimensional advection equation?
One of the results looks as follows (found it in old code of mine - means I once knew what to do here):
$u_2=u_1-c\cdot\frac{\Delta t}{\Delta x}(u_1-u_0)$
not sure if this is a time or a space discretization or both?
I only thought about replacing $\frac{\partial u}{\partial t}$ with $\frac{u_1-u_0}{\Delta t}$ and $\frac{\partial u}{\partial x}$ with $\frac{u_1-u_0}{\Delta x}$
which leads to
$(u_1-u_0)\left(\frac{1}{\Delta t}+c\cdot\frac{1}{\Delta x}\right)$
but not to the result above - which seems to be the correct one (plotted the above/or the code I've written some time ago creates an animation of plots over $t$ which seems to be correct)