The wave equation

Directly to the input form

 
  • The wave equation is the most prominent example of a second order hyperbolic differential equation. The variant which we consider here has one space dimension and reads
    (d/dt)**2 u = c**2 (d/dx)**2 u
    with x in ]0,1[ and t > 0. The characteristics of this equation are the lines
    t = (1/c)*x + a1 , t= -(1/c)*x + a2
    with arbitrary constants a1, a2. c has the meaning of speed of propagation.
  • This equation describes the simplest form of a wave propagation.
  • In order to get a well posed problem one needs boundary conditions for the boundaries x=0, t >= 0 and x=1, t >= 0 and initial conditions for the initial displacement u(x,0) and is speed (d/dt)u(x,t), t=0. The present implementation fixes the boundary values at
    u(x,t)=0, x in {0,1}
    and also the initial speed to
    (d/dt)u(x,t)t=0=0.
    This has the advantage that the exact solution is known analytically: take the odd periodic continuation of u(x,0) over the complete real axis. Given a point (x,t) with 0 <= x <= 1, t > 0 draw the two characteristics through this point and follow them to their intersection with the x-axis. Take the midvalue of the function values of this continuation at these points: this is equal to u(x,t). Hence given an arbitrary u(x,0) (of course with u(0,0)=u(1,0)=0) we know the discretization error of any method we might try.
  • you may think of u as the normal displacement of a string of length one, fixed at its ends and of (d/dt)u as its initial normal displacement speed.
  • Here we use the standard 5 point difference discretization of the differential operator. This is equivalent to using the vertical method of lines on the x-grid and then Störmers discretization method for a second order ordinary differential equation in explicit form.
  • The scheme reads
    uhj,n+1 = 2*uhj,n-uhj,n-1
    +((Δtx)*c)**2*(uhj+1,n-2*uhj,n+ uhj-1,n)

    n denotes the time step and j the number in the space grid.
  • The discretization is second order consistent in Δx, Δt and convergent if the Courant-Friedrichs-Levy condition is satisfied, which boils down here to
    c*Δtx < = 1 .
 

Input

 
  • There are three predefined cases for u(x,0) but you also have the possibility to define the initial displacement yourself.
  • In this latter case you need to specify
    1. A title text for the graphical output.
    2. the initial displacement u(x,0) as a piece of code following FORTRAN conventions.
  • You specify the wave speed c. Important: c >0 !
  • The number n of grid points along the x-axis including the two boundary values: Important 3<=n<=2000 !
  • The endtime tend of the computation. Important: tend > 0 !
  • The number m of time steps. This implies
    Δt= tend/m.
    It is necessary to satisfy the Courant-Friedrichs-Levy condition! That is
    ((n-1)/m)tend <= 1/c .
  • The number eachx of vertical lines in t-direction for the plot. Important : 1 <= eachx <= (n-1)/2 !
  • The number eacht of horizontal lines for the plot. Important : 1 <= eacht <= (m-1)/2 !
  • You specify your view point via two rotation angles for the x and the u-axis.
 

Output

 
  • You get two plots: one with the computed solution and one with the discretization error on the required grid. More precisely you get the piecewise linear interpolation of uh which may look strange if you use a crude grid.
 

Questions?!

 
  • Can you verify the statement on the convergence order by varying n and m ?
  • What takes place if you use a ''tricky'' combination of n,m,c ? Think about the role of the characteristics!
  • What appears if you use a nonsmooth initial displacement or one which is incompatible with the boundary conditions?
 

To the input form

 
Back to the top!

29.05.2016