I am trying to make a code for 1D shallow water equation (nonlinear without source terms) using the MacCormack method for sinusoidal wave propagation. My issue is that the wave fluctuates and does not produce a smooth result. I think there might be an issue with my boundary conditions as I am giving boundary condition in linear terms:
\begin{align} h=a\sin\left(\frac{2\pi n}{T}\right)\\ u=\left(\frac{g}{h_0}\right)^{1/2}h \end{align}
where $n$ is temporal, $a$ is $0.1$, and $h_0$ is $1$ meter. $\Delta t$ is $0.01$ and $\Delta x$ is $0.1$. If I understood my problem correctly, please tell me how I can give boundary conditions for the nonlinear terms of shallow water equation.