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:

  1. Does the non-smooth initial condition I have cause this problem? My guess is yes
  2. 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)?
  3. If it is not a dispersion problem, what is it? How can I solve it without changing the initial condition?
  • $\begingroup$ Can you specify which finite difference scheme you are using in time and space? $\endgroup$
    – whpowell96
    Commented Nov 5, 2023 at 16:11
  • 1
    $\begingroup$ I am using the centered difference scheme. To solve my problem, I am using a 5 point kernel. 3 points in space and 3 points in time. $\endgroup$ Commented Nov 5, 2023 at 18:12
  • $\begingroup$ what is the value of $v_0$ in the examples? $\endgroup$
    – timur
    Commented Mar 16 at 4:02
  • $\begingroup$ The value is $v_0 = 10.5$ $\endgroup$ Commented Mar 16 at 10:16

1 Answer 1


It isn't the spike that's causing the dispersion. The scheme you use has a dispersion relationship whereby waves of different frequency travel at different speeds. Every numerical scheme has such a dispersion, though some have it more than others.

The reason why you see it so pronounced in your example is that for discontinuous solutions, a Fourier decomposition will show you that you have both substantial low and high frequency components, whereas for smooth solutions the higher frequency component is fairly small. So in smooth solutions, even though dispersion happens, it is not as visible.

There have been decades of research into reducing the effects of dispersion in numerical schemes. I am not an expert on finite difference schemes, but you are likely going to find a large number of papers from the 1980s and 1990s on the topic. For the finite element method, where I feel much more at home, you might want to look up topics such as least-squares finite elements for the wave equation, or some of Tom Hughes' stabilization techniques from around 1990.

  • 1
    $\begingroup$ Additionally, I would say that WENO/ENO finite volume schemes would also solve this problem pretty easily with far less oscillations. Such methods were designed explicitly to combat this phenomena. $\endgroup$
    – whpowell96
    Commented Nov 6, 2023 at 19:42
  • 3
    $\begingroup$ @whpowell96 True, but they just have less dispersion. It's not like they have no dispersion at all. $\endgroup$ Commented Nov 6, 2023 at 23:59

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.