# Finite-difference discretization for a convective term

How does one discretize the classical convective term in a transport equation using finite differences? I know the finite volume schemes out ther i.e. upwind, central differencing etc. Are there direct finite difference analogs?

I am modelling gas combustion in porous media. There are several PDEs involved and my question is about the energy equation for the gas. Here it is:

$\epsilon \rho_g C_{pg} \frac{\partial T_g}{\partial t}+ C_{pg} \nabla( \rho_g \bar u T_g) = -\epsilon \rho_g Q \frac{dC}{dt}+\alpha_\nu(T_s-T_g)$

$T_g$ is the gas temperature, $T_s$ is the solid. The term of interest is $\nabla( \rho_g \bar u T_g)$.

• Hi Tiam:) It would help us out a lot if you could specify the PDE what you are solving. Are you referring to the full navier stokes equations or just the first order hyperbolic pde? – Paul Apr 9 '12 at 19:05
• Its actually a PDE system for modelling gas combustion in porous media. The gases energy equation has a term for temperature convection $\nabla(\rho u T)$. – tiam Apr 9 '12 at 19:07
• @tiam: Could you include your comment in your question and perhaps state the equations using LaTeX notation? MathJax will convert your LaTeX notation into pretty looking mathematics, as seen in my edit of your comment. – Geoff Oxberry Apr 9 '12 at 19:37
• Thanx, Geoff, didnt know it was so easy to add math here. – tiam Apr 9 '12 at 19:52
• What order of accuracy are you looking for? Do you expect shocks to appear in the solution? Is the velocity a dependent or independent variable? Can it change sign? – David Ketcheson Apr 10 '12 at 13:49

First of all, I'm going to assume that by $\nabla(\rho_g \bar u T_g)$ you actually mean $\nabla \cdot (\rho_g \bar u T_g)$, the divergence of $\rho_g \bar u T_g$. If this were not the case, you wouldn't be working with a conservation law and your equation wouldn't make much sense on account of adding scalar quantities to vector quantities.

Second, I think there may some confusion about finite volumes and finite differences. The term finite difference is a bit confusing, since it refers to both a type of stencil and a type of method. A finite difference stencil is an expression, defined on a grid, that approximates a term, or a sum of terms, in a differential equation by using adjacent grid points. In a one-dimensional, unstructured grid setting, a finite difference stencil can be described as an expression of the form $$F(u_{i-j},\ldots,u_{i+k})$$ that approximates a function of $u$ and/or its derivatives at the grid node $u_i$. (Here $j, k \geq 0$ are integers, of course.)

A finite difference method, in contrast, is an approach that attempt to directly discretize function derivative terms onto a mesh using finite difference stencils derived from Taylor series arguments. Such a method does not, in general, preserve aspects of differential equation structure; finite difference methods are not in general conservative. Note that both centered difference methods and basic upwind methods would typically be grouped in with finite difference methods.

Finite volume methods, by contrast, are designed with the structure of conservation laws in mind. Recall that general conservation laws have the form $$u_t + \nabla \cdot F(u) = 0,$$ where of course $F$ may depend on other quantities as well. The key idea is that, if this PDE is integrated over a small volume region -- a finite volume -- then we can appeal to the divergence theorem and recast the divergence term as a surface flux. Since surface fluxes between adjacent regions will be equal in magnitude and opposite in direction, the method is conservative. And if we treat the grid values of our functions -- in this case $u$ -- as being cell averages, then we can actually recast a finite volume method into a straightforward finite difference stencil, albeit possibly with the added complexity of flux limiters and upwinding.

To get back to the main thrust of your question, both centered differences and basic upwind techniques are generally ill-advised if an accurate method is desired that is capable of resolving shocks. Centered differences are particularly problematic, as they do not respect the characteristic direction of information propagation inherent to conservation laws. Instead, there are a number of more modern approaches that do a much better job.

One of the most accurate methods available is Godunov's method. Godunov is a finite volume approach to conservation laws and is able to resolve shocks by exactly solving local Riemann problems on the surfaces between adjacent finite volume cells. Unlike other methods that use approximate Riemann solvers or attempt to avoiding differencing across shocks, Godunov's method introduces very little artificial viscosity, and is thus particularly valuable for resolving convection in inviscid or near-inviscid problems. Of course, there is a price to pay for such high accuracy, and Godunov's method is one of the more difficult methods to program -- particularly for unstructured domains -- and is also quite computationally expensive. For more information on Godunov's method and other exact and approximate Riemann-solving finite volume methods, I highly recommend [1].

On the other end of the spectrum are methods that do not resolve shocks exactly, but attempt to approximately "capture" them by appropriate choice of finite difference stencil. These are broadly called shock-capturing methods, and one of the classic examples is the class of essentially non-oscillatory (ENO) methods. ENO methods use standard finite difference stencils derived from Taylor series, but make use of local information, in the form of Newton divided differences, to choose stencils that avoid differencing across shocks. This is advantageous because finite difference stencils are typically only accurate if the underlying function is locally smooth.

I suggest [2] for a remarkably clear introduction to the basics of ENO methods, but a Google search will turn up dozens more references. ENO schemes do not resolve shocks nearly as well as Godunov's method, and are not appropriate for inviscid or near-inviscid problems, but they are remarkably easy to program and are quite computationally efficient.