# How to discretize Burger's equation?

I am trying to solve the very simple one dimensional burgers equation which is:

$$\frac{\delta U}{\delta t} + \frac{\delta F}{\delta x} = 0$$

where the flux F of some variable U is defined as$$F= \frac{U^2}{2}$$

If I consider a small control volume around the node i, then I should write the original equation as:

$$\frac{U_i^{n+1} - U_i^{n}}{\Delta t} + \frac{ F_{i+0.5}^{n} - F_{i-0.5}^{n}}{\Delta x} = 0$$ I am using linear interpolation to calculate the F values at the edges of control volume. I am defining F at the node i as

F[i] = 0.5*0.5*(u[i] + u[i+1])*0.5*(u[i] + u[i+1]);


and then modifying the function's value as:

unew[i] = u[i] - (dt/dx)*(F[i] - F[i-1]);       //Final Equation//


However this approach is leading to divergent results which I don't really understand why.

P.S. I want to have the discretized equation in the form of Final Equation because I further want to use adaptive mesh refinement and if the discretized equation is in this form, it is easy to apply.

• Tried the flux spitting scheme on Page 41 of astro.uu.se/~bf/course/numhd_course_20100124.pdf and it worked really well. It implements Courant-Isaacson-Rees (CIR) Scheme. Though there is no much explanation about discretizing this way. Looking forward for comments of experts on this. – Tanmay Agrawal Aug 11 '15 at 7:16
• This looks like a forward-in-time / centred-in-space approach which is typically unconditionally unstable (i.e. unstable for every time step $\Delta t > 0$). See e.g. en.wikipedia.org/wiki/FTCS_scheme – Daniel Aug 11 '15 at 7:47
• @DanielRuprecht What will you suggest in that case? I do not want to go for complex schemes because if I use them, it would be more difficult to use the mesh refinement strategy on that. – Tanmay Agrawal Aug 11 '15 at 7:56
• There is a huge range of methods you could use, so I find it difficult to make a specific suggestion. You could take a look e.g. into the excellent book by LeVeque (cambridge.org/us/academic/subjects/mathematics/…) to get some ideas. A simple and straightforward approach might be to go for something like a Lax-Wendroff method ( en.wikipedia.org/wiki/Lax%E2%80%93Wendroff_method ). This is similar to your approach, but adds some numerical diffusion to stabilise the scheme. – Daniel Aug 11 '15 at 8:03
• @DanielRuprecht Thanks for the reference. I was just reading an another book of him called "Numerical Methods for Conservation Laws". I will look into the one you mentioned. Earlier, I was using Lax-Wenderoff and it obviously gives good results, I am just looking to make my scheme even more simpler. – Tanmay Agrawal Aug 11 '15 at 8:14

If you want the simplest possible numerical scheme working for Burger's equation that has your suggested form then you should prefer the so called Lax-Friedrichs method.

If you have the book of LeVeque on Finite Volume Methods for Hyperbolic Problems, look for a very simple formula 4.20 (or a little bit more complex 4.21, but in your suggested form). With that scheme, the oscillations shall disappear.

Be aware that with the Lax-Wendroff scheme mentioned in other response the oscillations in numerical solution can remain, because it is so called second order accurate method that can not avoid the oscillations in general. The Lax-Friedrichs method is only first order accurate.

If the simplicity is your criterion number one, then be aware that you can have still a strange behaviour of numerical solution with Lax-Friedrichs method, the so called clustering of values, see Figure 12.3 in the book of LeVeque.

If you want to avoid such clustering, take the Godunov scheme, see the formula 12.2 that is also first order accurate with no oscillations in numerical solution and no clustering.

If you know in advance that your initial function (you know you need to know the values of $U(x,0)$) is positive everywhere, then the scheme 12.2 turns to the so called upwind scheme that has very simple form

$$F_{i-0.5}^n=0.5 (U_{i-1}^n)^2, \quad F^n_{i+0.5}=0.5 (U_i^n)^2 .$$

• I am highly thankful for your detailed answer. I am using a cosine wave as my initial function so it has got both positive and negative values. In this case, which scheme shall I use? Did you notice me mentioning in an earlier comment that the flux splitting by CIR method worked really well for me in this case. But I do not know if it is any good for other cases or not. – Tanmay Agrawal Aug 12 '15 at 20:59
• The "flux-splitting" by CIR method you mention in (by the way nice) reference is not that far from Godunov method, see your reference on the page 44, the formula (189) where it is defined only for Burger's equation. This method I recommend to you as the simplest one and working in general with no artefacts, especially if you use later grid adaptivity. If you are interested in further improvements, see e.g. the suggestions of @David_Ketschson. – Peter Frolkovič Aug 13 '15 at 6:45

@Peter Frolkovic's answer is a good one, but @Daniel Ruprecht's comment also deserves to be highlighted: the scheme you are using (centered in space, forward in time) is unstable for any time step size. It's straightforward to see this if you consider instead the advection equation and do a standard von Neumann or method of lines stability analysis. This is covered in most introductory books on numerics for hyperbolic PDEs or finite difference methods.

Another resource for learning about good methods to solve this type of equations is my HyperPython course; in particular, the 3rd lesson will take you beyond the first order methods mentioned in @Peter Frolkovic's answer.

• I agree that using FTCS scheme was a silly mistake at my point. I have tried using Lax-Wenderoff, Lax-Friedrichs scheme to solve Burger's equation and they have got me pretty good results. The simplest looking scheme that I found so far would be CIR scheme as I mentioned in an earlier comment. Though I do not completely understand the concept behind the flux splitting in that case. – Tanmay Agrawal Aug 12 '15 at 20:58
• The Burger's equation can be written as quasi-linear advection equation $$U_t + F_u U_x = 0$$ with the speed $F_u = U$ depending on the solution. If you have a general initial function like cosine, you must distinguish in "flux-splitting" schemes between three situations, $F_u>0, F_u=0, F_u<0$ for $F_{i-0.5}$ AND $F_{i+0.5}$ and that is the idea, roughly, behind the Godunov scheme (189) in the reference you mentioned. If you really care even more about the simplicity ;-), an elegant way to write this formula is in the book of LeVeque on page 229, the formula 12.4. – Peter Frolkovič Aug 13 '15 at 7:11
• @PeterFrolkovič Thanks a lot for the detailed response. I had seen eq. 12.4 when I was curious about Godunov method. But since before that, I had already tried the CIR scheme and it worked well. So probably I will incorporate the entropy fix condition in the existing case and use grid adaptivity on that (equation 189). – Tanmay Agrawal Aug 14 '15 at 7:11