1
$\begingroup$

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.

enter image description here

$\endgroup$
  • 2
    $\begingroup$ Are you sure that your Courant number $C$ defined as the ratio between the physical velocity $\underset{x}{max}{(v(x))}$ and the mesh velocity $\Delta x/\Delta t$ is less that $1$ for an explicit scheme? $\endgroup$ – HBR Sep 9 '17 at 11:12
  • $\begingroup$ Have you checked to make sure that it's actually the BCs and not the scheme? You could use periodic BCs and an appropriate IC. My guess is that in reality you have done everything fine but that you are seeing the oscillations introduced by the shocks that form (unless you have accounted for that already). $\endgroup$ – Kyle Mandli Sep 10 '17 at 15:31

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.