# How to demonstrate the order of convergence of FTBS method for solving a hyperbolic PDE

consider the Purely hyperbolic model problem $$u_t+au_x=0$$ $$u(-1,t)=u(1,t) \text{ (periodic boundary)}$$ $$u(x,0)=f(x)$$

with $$f(y)=\sin(2\pi y)$$. Furthermore the exact solution is given by $$u(x,t)=f(x-at)$$. I have implemented Forward–time backward–space (see page 1: http://www.etakl.net/notes_etc/numerical/schemes.pdf ) on a uniform grid in time and space and the figure demonstrates my results with certain values of dt, dx and a.

MY QUIESTION: How can I construct a test/example to demonstrate the order of convergence? In theory the order of convergance should be 1 in time and 1 in space, right? I am using the FDM book by LeVeque and this problem is from chapter 10. I am using Python and I will be happy to share my code if needed. Thanks

• If anyone else ever stumble upon this question, feel free to drop a comment at ask! I did solve it after getting help from nicoguaro♦ :) – k.dkhk May 3 at 21:45

## 1 Answer

You could refine your discretization and then compare the logarithm of the error ($$\log |e|$$) with the logarithm of the size ($$\log h$$) of your elements. Using a linear regression you could obtain an approximation of the order of convergence. Keep in mind that this order of convergence is asymptotic when $$h \rightarrow 0$$, so, for "large" $$h$$ you could see a different behavior.

• But when I change my step size in time (dt) to compute the errors, do I need to keep step size in space (dx) constant? – k.dkhk May 1 at 21:58
• No, that would make your scheme unstable. – nicoguaro May 1 at 22:04
• And how should I measure the error? Should I take difference between my method and the exact solution at every gridpoint (in time and space) and define the error as the sum of them all? – k.dkhk May 2 at 16:01
• You could sample your analytical solution and then compute the $L_2$ norm of the difference. – nicoguaro May 2 at 18:25
• Yes, that's the $L_2$ norm. Feel free to share a link to the plot here or to create a chat room. – nicoguaro May 3 at 2:28