# discretizing the convection-diffusion equation using finite difference method

I am new to to the finite difference method and I want to understand how a convection-diffusion equation is discretized in 2-D by using central differences:

$$\nabla\cdot(\rho \vec{v} \Phi)=\nabla\cdot(\Gamma \vec{\nabla} \Phi)$$

I believe the discretization would yield :

$$\frac{\Phi_{i+1,j} - \Phi_{i-1,j}}{2h}v_x+\frac{\Phi_{i,j+1} - \Phi_{i,j-1}}{2h}v_y =\frac{\Gamma}{\rho} \frac{\Phi_{i+1,j} + \Phi_{i-1,j}+\Phi_{i,j+1} + \Phi_{i,j-1}-4\Phi_{i,j}}{h^2}$$

I hope I've got it right, as I believe this is exactly the case for a problem with constant velocity, density etc.

What I want to know is how can I proceed to solve the same problem for an equation with a non uniform velocity for example.

I worked a little on the problem with non-uniform velocity and I would really appreciate if someone could confirm or point out how my result is wrong. This is what I ended up with for a non uniform velocity:

$$\frac{\Phi_{i+1,j} - \Phi_{i-1,j}}{2h}v_{x_{i,j}}+\frac{\Phi_{i,j+1} - \Phi_{i,j-1}}{2h}v_{y_{i,j}} +\Phi_{i,j}\frac{(v_{x_{i+1,j}} -v_{x_{i-1,j}}) + (v_{y_{i,j+1}} -v_{y_{i,j-1}})}{2h} =\frac{\Gamma}{\rho} \frac{\Phi_{i+1,j} + \Phi_{i-1,j}+\Phi_{i,j+1} + \Phi_{i,j-1}-4\Phi_{i,j}}{h^2}$$