code from: Connecting lakes: Modeling flows and interactions of organisms and matter throughout the waterscape