Design of an adaptive weir