# Algorithm for water spill problem

Hey guys and gals. I have come across a problem that I was wondering if anyone recognized.
I came across it while trying to find approximate solutions to a fluid-flow PDE, when the flow is high(The PDE is described in another one of my threads, but that is not important, I will describe the problem here), so I dont know if it is a problem that has been done before or if it has a name.

The problem is the following:

You have a solid surface given by z=b(x,y,t). At t=0, one of the surface's local minima, is filled up with water(it is contained to one "puddle"). At all times, the water surface is assumed to be of a constant height, h. The height is such that the volume of water is conserved. I.e. $\int_{b(x,y,t)}^{h} A(z) dz = const$, The area, A, is an area that is enclosed by z=b(x,y,t) and containing the said local minimum. As b(x,y,t) is changing over time, the water height will at some point get higher than a spill-point(This should be a saddle point in b(x,y,t) given t, i think). When this happens, the next step is to find the local minimum that you get to by taking the steepest decent route from the spillpoint. Then this minimum is filled up from the bottom, with the same rules as before(water height constant in each "puddle"), and with total water volume conserved. The process is repeated until the simulation time is over. One must also take into account the possibility of the "puddles" merging.

Anyone know of a similar problem or has any smart pointers on how to solve this? I need to make an algorithm for this, but its giving me a headache ^^