I am trying to simulate a fluid running through a 2-d rough landscape. The landscape is represented by a regular grid, and heights are just given as values to each cell (0,1,2 m).
For the sake of this question we can think of the landscape being a hole with smooth border and the fluid starts at a border, falls through it, and fills the hole.
We can assume heights follow a Gaussian distribution centered in the middle of the grid, multiplied by -1. I want to be able to calculate how much liquid will be on each cell, at each time-step.
From what I could gather, my problem is essentially a numerical integration of an advection equation. I could find this simple definition of an advection equation for 1-d.
$${\partial p \over \partial t} = u*{\partial p \over \partial x } $$ where $u$ is the strength of the flow, $x$ is the x-coordinate and $t$ is time
with an easy to implement simple numerical solution based on upstream differencing:
$$ p_x^{t+1} = p_x^t + \frac{\Delta t}{\Delta x}u(p_{x}^t - p_{x-1}^t) $$
$t$ is just a label on this formula.
However, how can I change this formula for the 2-d case, and more importantly when $u$ changes depending on the cell, so we can add the rugosity of the cell?
I think we can turn height in a vector field to represent different values of $u$ per cell (for example, using height differences between a cell and their neighbors). I also think we can use the MacCormack method to somehow do the numerical integration, since it seems to work with non-linear functions. But I'm lacking not seeing how to plugin this vector field and use this method correctly.