How dams can go with the flow