@artificialmind Here's the whole update code. bed is NxN array of terrain elevation, water is NxN water column height (so bed + water is the height of water surface), flowx is (N+1)xN of horizontal pipes, and similarly flowy is Nx(N+1) for vertical pipes.