I wrote this simulation while working with a professor at Harvard University doing research in computational geomorphology during my freshman year.
The rate of erosion at every point is proportional to the slope of ground and the volume of rainwater that would pass over that point in the drainage network.