I'm having difficulty with numerically solving the inviscid burgers equation.Godunov's scheme is used in most of what I've found in literature . Now my question is if using a crank nicolson shceme is wrong or not?

$\frac{\partial u}{\partial t} + u\frac{\partial u}{\partial x}=0$

with this BC:

at $t> 0 ,x=0$ : $u=1$

using a finite volume method:

$\frac{\partial }{\partial t}\int udv + \int u\frac{\partial u}{\partial x}dv=0 $

$\frac{\partial u}{\partial t}\Delta v +(uuA) _{e}-(uuA) _{w}=0$

$\frac{\partial u}{\partial t} + F_{e}u_{e}-F_{w}u_{w}=0 $

$F=\frac{u}{\Delta x}$

and for discretization in time I used Crank-Nicolson

$u_{p}^{n+1}-u_{p}^{n}=\frac{\Delta t}{2}(-F_{e}u_{e}+F_{w}u_{w})^{n+1}+\frac{\Delta t}{2}(-F_{e}u_{e}+F_{w}u_{w})^{n}$

the final form of equation is as (upwind scheme) :

$(1+\frac{\Delta t}{2}F_{e})u_{P}^{n+1}=(-\frac{\Delta t}{2}F_{w}) u_{W}^{n+1} +u_{P}^{n}+\frac{\Delta t}{2}(F_{w}u_{w}-F_{e}u_{e})^{n} $

and for the first block :

$(1+\frac{\Delta t}{2}F_{e})u_{P}^{n+1}= u_{P}^{n}+\frac{\Delta t}{2}(-F_{e}u_{e})^{n}+\Delta t F_{w}u_{w}$

and after that I tried to solve a set of linear algebraic equation. The result in every time step seems to converge but with time passing the magnitude of velocity is also increasing which is an indication of a mistake.

  • 1
    $\begingroup$ I would recommend Method of Lines approach: turn your partial differential equation into a series of ordinary differential equations and use standard ODE solver to solve them. That is, don't discretise the time derivative. To get something working use upwind discretisation on the spatial derivative. Then, once you have a working reference, improve the accuracy as needed. My notes here might help. I solve non-linear Fishers equation with MOL and FVM. danieljfarrell.github.io/FVM/… $\endgroup$
    – boyfarrell
    Jun 13, 2016 at 8:31
  • $\begingroup$ You could look into work by R. LeVeque. Here is a Clawpack example for Burgers' equation $\endgroup$
    – Steve
    Jun 13, 2016 at 21:15
  • $\begingroup$ Just a critique on notation. I recommend carrying the $n+1$ on $F_e$ and $F_w$ after your temporal discretization. $\endgroup$
    – Charles
    Jun 14, 2016 at 5:42
  • $\begingroup$ What method are you using to solve the resulting set of linear algebraic equations? $\endgroup$
    – Charles
    Jun 14, 2016 at 5:43
  • 1
    $\begingroup$ Can you give more information about your configuration? Are your variables (velocity) on a staggered or collocated grid? Also, not to nit pick, but is there a difference between your upper and lowercase $w$ subscript? Does the $p,e,w$ indicate staggered grid locations? What method are you using to enforce continuity? Is this a compressible flow? What are your boundary conditions? $\endgroup$
    – Charles
    Jun 14, 2016 at 5:49

2 Answers 2


If I understand correctly, you are using a centered finite difference in space and the implicit trapezoidal method in time. That scheme is unconditionally absolutely stable, but will generate spurious oscillations. So you should expect to see some increase in the maximum value of $u$, but it shouldn't blow up. If it blows up, you have an implementation error (bug).

I'll add that this is a lousy method for a purely hyperbolic PDE, since it generates oscillations and isn't very accurate for large time steps anyway.

  • $\begingroup$ I think you're probably right though I tried solving this using the conservative form : $\frac{\partial u}{\partial t}+\frac{1}{2}\frac{\partial u^{2}}{\partial x}=0$ and I've got reasonable results. After that I added the viscous term in equations and it also worked . Thanks for the help. $\endgroup$
    – mojijoon
    Jun 19, 2016 at 4:51

Thank you for your clarification.

The Thomas algorithm solves $Ax=b$ when, e.g., A is a tridiagonal matrix (there are other special cases I believe, but this is not one of them). Your "final form of equation" does not appear to be in this form, nor does it look like this is possible.

As @David Ketcheson mentioned, implicit time marching is not very attractive for problems like this. Usually the diffusion term is treated implicitly in time, and for good reason.

Explicit time marching has numerical stability restrictions due to the advection and diffusion terms

$\Delta t < C_1 \frac{\Delta x}{\max(U)}$

$\Delta t < C_2 \frac{\Delta x^2}{\nu}$

respectively. The latter is often more restrictive (for diffusion dominant problems or when node points are highly clustered). Often, the advection term is treated explicitly and the CFL condition is used to determine the largest allowable time step when the diffusion term is not a problem.

As @David Ketcheson mentioned in his comment, explicit Euler is not a good choice for central differencing since it is unconditionally unstable. However, upwinding schemes with explicit time marching is frequently used in high Reynolds number CFD, so I imagine that it is applicable here, however, you cannot use central differencing since you have no diffusion.

As for spatial discretization, there is a lot of literature on upwinding schemes.

  • $\begingroup$ Some parts of this answer are helpful, but explicit Euler is unconditionally (absolutely) unstable for the spatial discretization and the problem in question -- note that the OP is studying the inviscid Burgers equation. $\endgroup$ Jun 16, 2016 at 17:44
  • $\begingroup$ My mistake about including central differencing, I forgot there's no viscosity. However, I will say that I think this is more of a problem about temporal discretization than about spatial discretization. I'll fix my answer. $\endgroup$
    – Charles
    Jun 16, 2016 at 18:41
  • $\begingroup$ For every row of the coefficient matrix there is a non zero diagonal element (for $u_{P}$) and a non zero element before that (for $u_{W}$), so I think the matrix could be considered as a tridiagonal one if we consider the the third element as zero. thanks for your time and your comments $\endgroup$
    – mojijoon
    Jun 19, 2016 at 5:00
  • $\begingroup$ Hm, maybe you are right. Can you please put the equation in the form Ax=b first? $\endgroup$
    – Charles
    Jun 19, 2016 at 5:07

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.