I consider ordinary wave equation $$ u_{tt} - u_{xx} = 0 $$ with initial conditions $$u(x, 0) = \exp (-2 x^2) \\ u_t(x, 0) = 0 $$

To solve this problem I approximate $u_{xx}$ with 4-th order difference scheme and find time evolution with symplectic 4-th order method.

I use following parameters: $$x_{min} = -500 \\ x_{max} = 500 \\ dx = 0.5 \\ dt = 0.1 $$

The problem is that, for example, in the point $x=0$ this algorithm perfectly works for $t < 1000$ (note that this value equals $x_{max} - x_{min} = 2 x_{max}$ But then evolution looks quite strange. Here is a picture of this.

enter image description here

I tried to fix boundary value manually (at every step set $u(x_{min}, t) = u(x_{max}, t) = 0, \ u_t (x_{min}, t) = u_t (x_{max}, t) = 0 $ ) and also tried to use "exponential suppression" to avoid radiation from boundaries. The $u_{xx}$ approximation with finite difference is used only for points which are more than 2 steps distant from boundaries to avoid problems.

It seems that the problem lies in the presence of boundaries, because such symplectic algorithm works fine for harmonic oscillator (where there are no boundaries) for any time value.

UPD: The stencil I use for partial derivative: $$u_{xx} (x) = \frac{-u(x-2) + 16 u(x-1) - 30 u(x) + 16 u(x+1) - u(x+2)}{12 (dx)^2} $$

  • 1
    $\begingroup$ Could you write down the fourth order stencil you are using and how exactly you are imposing the BC? Simply setting the values to zero in each time step does not sound right but may be I misunderstand what you do. $\endgroup$ – Daniel Feb 7 '16 at 8:08
  • $\begingroup$ have you tried smaller stepsizes? or a simple 'implicit Euler scheme'? $\endgroup$ – Jan Feb 7 '16 at 14:14
  • $\begingroup$ You use a CFL number of 0.2. Is this small enough for an RK4 integrator? $\endgroup$ – Wolfgang Bangerth Feb 8 '16 at 6:12
  • $\begingroup$ @DanielRuprecht , I wrote a stencil. I impose BC with setting values to zero at each time step, why does this not sound right? Also I use exponential suppression - tending all values to zero nearby the boundaries. $\endgroup$ – newt Feb 8 '16 at 18:18
  • $\begingroup$ @WolfgangBangerth , I don't know exactly values, but I hope so. Moreover, I tried different sets of stepsizes.As you see, evolution goes right way, but looks like boundaries cause such problems that I have. $\endgroup$ – newt Feb 8 '16 at 18:18

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.