I am trying to solve the wave equation $$ {\partial ^2u(t,x) \over \partial x^2} = {\partial ^2u(t,x) \over \partial t^2} \tag1 $$
with the following boundary and initial conditions:
$$ {\partial u \over \partial x} \Bigg |_{x=0}=0 \tag 2$$ $$ u(t,1) = 0 \tag 3 $$ $$ u(0,x) = 0 \tag 4 $$ $$ {\partial u \over \partial t} \Bigg |_{t=0}=\Bigg \{\begin{matrix} v_0 & if & x=0\\ 0 & if & x \neq 0 \end{matrix} \tag 5$$
I have one non-smooth initial condition which is usually not good for finite difference. However, I tried anyway and got the following output for $nt = 2600$, $nx = 500$ and $t_{max} = 2.5$:
I was interested in the cause of the oscillations and found this post. Apparently, the spike caused by the second initial condition most likely causes dispersion. In the answers to this question, I found that if the CFL number is equal to one, the dispersion would disappear. However, that did not happen in my case, as can be seen below (note that $dt = dx$, meaning that the CFL number is equal to one):
So I have a couple of questions:
- Does the non-smooth initial condition I have cause this problem? My guess is yes
- Is this still some sort of dispersion problem? If it is, is there a way I can handle it without changing the initial condition (for example by using a low-pass filter, or by using a special value of the CFL number)?
- If it is not a dispersion problem, what is it? How can I solve it without changing the initial condition?