Calculating differentials between cell velocities

48 Views Asked by At

If I have a 2D cell-based fluid simulator, which uses velocities and pressure, how can I find the change in pressure between the neighboring cells for a cell? I might be missing something big here, but I need to find the partial differential of pressure over with respect to the partial change in X, so the cells on the left and right.

In the shown picture, the cell with pressure of 2 is shown. This cell is at, lets assume, (2,1) given the borders on the bottom. How can I find the partial of pressure with respect to partial X if from the left it decreases by 0 but on the right decreases by 1?

Forgive any simple calculus mistakes which I may of made. Hopefully the answer is much more simple than I think. Thank you!

pic1