Solution (source code)

= Solution

These are the one-dimensional <shallow water equations> with bed slope and <friction>. The coordinate $s$ measures distance downstream, $t$ is time, $A(s,t)$ is the wetted cross-sectional area, $u(s,t)$ is section-averaged downstream <velocity>, and $h(s,t)$ is <water> <water depth> above the bed. Thus $Au$ is <water> volume flux and the first equation expresses <mass conservation>.

In the <momentum> equation, $u_t+uu_s$ is the material acceleration, $g$ is gravitational acceleration, and $S$ is the positive downward bed slope, so $gS$ drives the flow. The wetted perimeter is $l$ and $f$ is a dimensionless <friction> coefficient in the stated convention. The frictional deceleration is $flu^2/A$ for downstream flow, while $-gh_s$ is the <hydrostatic pressure> contribution from surface-height variation relative to the sloping bed. The formula $u^2$ assumes the chosen positive-flow direction; a bidirectional <friction> model uses $u|u|$.