Home

A discrete version of the divergence theorem

2009-06-20

The divergence theorem (Gauss's theorem) from vector calculus says

I am interested in the case where the vector field is derived from a scalar potential F = ∇u:

This theorem is for a continuous system in ℝ3. However, numerical algorithms often operate on discrete grids in ℤd where d = 2 or 3. I will now derive a discrete version of this theorem.

Definitions:

Let u be a scalar field on the grid u: ℤd → ℝ, x ↦ ux.

Let x, y ∈ ℤd. We'll use the Manhattan metric |x - y| = Σi |xi - yi|. Cells x and y are called adjacent if and only if |x - y| = 1. Note that diagonal cells are not adjacent.

Let V be a subset of ℤd. V' is the complement of V in ℤd.

Let nx be the number of cells adjacent to x in V. Therefore, nx = ΣyV, |x-y|=1 1.

Let the second-order finite difference Laplacian be given by Lx = - 2d ux + Σy, |x-y|=1 uy.

Theorem

Note that right-hand side involves only points on the boundary of V. These correspond to first-order finite difference derivatives. There is one term for each arrow in this diagram:

Proof

Starting from the left-hand side, expand the Laplacian to get a sum of field terms:

ΣxV Lx = Σx cx ux,

where cx are constant coefficients. From the definition of the Laplacian, we can see that cx = nx - 2d if xV, or cx = nx if xV':

= ΣxV ux (nx - 2d) + ΣxV' ux nx. (1)

Since each cell is adjacent to 2d others,

2d = Σy, |x-y|=1 1
= ΣyV, |x-y|=1 1 + ΣyV', |x-y|=1 1
= nx + ΣyV', |x-y|=1 1
2d - nx = ΣyV', |x-y|=1 1.

Now put this into (1):

ΣxV Lx
= - ΣxV, yV', |x-y|=1 ux + ΣxV', yV, |x-y|=1 ux
= ΣxV, yV', |x-y|=1 (uy - ux). ■