Depth-Averaged Specific Energy in Open-Channel Flow and Analytical Solution for Critical Irrotational Flow over Weirs