Solution (source code)

= Solution

The occupied cross-sectional area and interface width are
$$
A(h)=\int_0^h z\,dz=\frac{h^2}{2},\qquad b(h)=h.
$$
The incoming <volume flux> per unit channel length is $hw_e$. <Volume conservation> therefore gives $A_t+(Au)_x=hw_e$. Ambient fluid carries no excess <mass density>, so integrating the excess-<mass density> balance gives $(Ag')_t+(Aug')_x=0$. These two equations imply dilution of the <reduced gravity>, even though total integrated <buoyancy> is conserved.

The integrated horizontal <hydrostatic pressure> force, divided by the reference <mass density>, is
$$
\int_0^h g'(h-z)z\,dz=\frac{g'h^3}{6}.
$$
The prismatic walls contribute no axial component of pressure force. Since ambient fluid enters with zero horizontal <velocity>, it supplies no horizontal <momentum flux>. Thus the <entraining shallow-water current in a triangular channel> obeys the conservative equations
$$
\boxed{
\begin{aligned}
\partial_t\left(\frac{h^2}{2}\right)+\partial_x\left(\frac{h^2u}{2}\right)&=hw_e,\\
\partial_t\left(\frac{h^2u}{2}\right)+\partial_x\left(\frac{h^2u^2}{2}+\frac{g'h^3}{6}\right)&=0,\\
\partial_t\left(\frac{h^2g'}{2}\right)+\partial_x\left(\frac{h^2ug'}{2}\right)&=0.
\end{aligned}}
$$
To put them in primitive form, let $D=\partial_t+u\partial_x$ be the <material derivative>. The volume equation gives $Dh+(h/2)u_x=w_e$. Subtracting $u$ times the volume equation from the momentum equation, and $g'$ times it from the <buoyancy> equation, yields
$$
\boxed{
\begin{aligned}
Dh+\frac h2u_x&=w_e,\\
Du+g'h_x+\frac h3g'_x&=-\frac{2uw_e}{h},\\
Dg'&=-\frac{2g'w_e}{h}.
\end{aligned}}
$$
The momentum source is the acceleration of newly entrained ambient fluid, not bed drag. The source in the <reduced gravity> equation describes mixing with ambient fluid of zero excess <mass density>. In particular, the rectangular-channel coefficients cannot be used: the triangular area produces both $h/2$ in the depth equation and $h/3$ in the <buoyancy>-gradient force.