Dismiss Notice
Join Physics Forums Today!
The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

Python Using backward vs central finite difference approximation

  1. Oct 5, 2016 #1
    I am solving the simple 2nd-order wave equation:

    $$ \frac {\partial ^2 E}{\partial t^2} = c^2 \frac {\partial ^2 E}{\partial z^2} $$

    Over a domain of (in SI units):

    ## z = [0,L=10]##m, ##t = [0,t_{max} = 10]##s

    and boundary/initial conditions:

    $$ E(z=0) = E(z=L) = 0 $$

    $$ E(t=0) = -E(t=t_{max}) = sin(\frac{\pi z}{L}) $$

    I know the analytic solution, but am trying to solve it numerically. (The numerical and analytic solutions are compared to test accuracy.) I just had a couple questions:

    1) When I solve the wave equation by applying a central difference approximation of order 2 on the second derivative of time, the code works perfectly fine. Although when I apply http://(https://en.wikipedia.org/wiki/Finite_difference_coefficient#Forward_and_backward_finite_difference) [Broken] of higher orders for the second derivative in time, my solution diverges. Is there any particular reason why using a backward difference approximation would be worse than a central difference approximation of the same order? I was under the impression using a higher order backward difference method would give me higher accuracy, but it appears to not work at all. I can supply the code if needed, although it's a fairly basic implementation.

    2) I am able to solve the equation above when using a central difference approximation and setting ## c = 1## m/s, but if I use ##c = 3 \times 10^8## m/s, the solution diverges. This makes sense as the Courant number (##C_o = c \frac {\Delta t}{\Delta x}##) is much greater than one. But I am curious: are there any possible finite difference schemes that can be applied to numerically solve the equation if ##C_o >> 1##? I have read a bit about BDF methods to help solve stiff equations, but in this case, the only problem is that a more precise grid is needed, correct? I had also heard about spectral methods, but am still trying to learn how to implement them and if they would be applicable/accurate enough if other (nonlinear) terms were included in the wave equation.
     
    Last edited by a moderator: May 8, 2017
  2. jcsd
  3. Oct 11, 2016 #2
    Thanks for the thread! This is an automated courtesy bump. Sorry you aren't generating responses at the moment. Do you have any further information, come to any new conclusions or is it possible to reword the post? The more details the better.
     
Know someone interested in this topic? Share this thread via Reddit, Google+, Twitter, or Facebook

Have something to add?
Draft saved Draft deleted