I currently have a code that solves $u_t+ cu_x=0$ with periodic boundary conditions, and constant $c$ (using an upwind method). I'm wondering how I would alter this code to solve something of the form $$u_t +c(x) u_x=0.$$ I'm thinking it will look of like
$$u_i^{j+1}=u_i^j-c_i \Delta t \left(\frac{u_i^j-u_{i-1}^j}{\Delta x} \right),$$ where $c_i=c(x_i)$?
I know that generally, the upwind scheme is stable for $c \frac{\Delta t}{\Delta x} \leq 1$. How would this change with a variable $c$? Am I better off using another method?