I think I’ve worked out a lot of the planning errors. The code worked before but the result was not very accurate because I didn’t segment the river properly. The current version places height calculations at the center of the cell and the flow at the cell edges. This is using a semi-implicit method.
This video shows a run that includes a slope with inflow from upstream. There is also a tidal and faster oscillation from the ocean side (left boundary).