A small diffusion coefficient changes the numerical problem
A steady concentration profile may be transported to the right while diffusion smooths it. The boundary conditions can then create a narrow region of rapid change near the outflow. A formula that is second-order accurate for a fixed smooth function may still give visibly wrong values when the grid is too coarse to resolve that region. We will see why, using a problem whose algebra and exact solution can both be inspected.
Let and consider
Here fixes the transport direction; the left endpoint is the inflow. We assume enough smoothness whenever a truncation estimate is used. A finite difference value approximates a point value, not a cell average.
Two stencils and the mesh Péclet number
Definition 3.4.1
(Centered and upwind stencils and the mesh Péclet number)
Choose , , and . The centered and backward-upwind operators are
Impose , and set either operator equal to at each interior node. Backward means looking toward the inflow when ; it would not be the upwind direction for . The dimensionless ratio is the mesh Péclet number. Multiplication by exposes the coefficients:
The coefficients of the neighbors are nonpositive for centered differences only when ; they are always negative for the upwind stencil. This sign condition provides a comparison principle, a stronger statement than the mere existence of a solution.
Comparison and an error bound
Theorem 3.4.2
(Comparison on a finite grid)
For at any , and for when , suppose at every interior node and , where denotes the appropriate operator. Then at every node. The corresponding Dirichlet system has a unique solution. If and , then
where the norm on the right is over interior nodes and the left is over all nodes.
Proof
(Minimum propagation and a linear barrier)
Suppose instead that the minimum of is negative. It occurs at an interior node. Write each stencil as a positive multiple of plus a nonnegative multiple of . Both differences are nonpositive at the minimum. Since their sum is nonnegative and the left coefficient is strictly positive, the left neighbor has the same minimum. Repeat until reaching , a contradiction. This also handles the endpoint case , when the centered right coefficient vanishes. Comparison applied to and proves uniqueness of the homogeneous system; a square injective matrix is invertible.
For the estimate let and set . Both operators give because they differentiate a linear function exactly. The endpoint values of are nonnegative and . Comparison gives . This bound is valid for fixed ; it is not a bound uniform as .
Proof X-ray
Why a residual needs a stability estimate
The proof has two parts with different hypotheses. The comparison step uses only the signs of the stencil: a strictly positive coefficient on and a nonnegative one on . That is where enters for , and why the strictness is on the inflow side: at the right coefficient vanishes, but the minimum can still be pushed left, step by step, until it meets the boundary value . The second part needs one more ingredient, a barrier: a grid function with . Here works because both stencils differentiate linear functions exactly, and its size is the stability constant. The key move is to compare not with but with , which converts the bound on the residual into a bound on the error. Invertibility alone gives a bound on for each grid, but not necessarily one independent of ; the barrier supplies that.
Consistency is not a layer-uniform guarantee
Assume , exact boundary data and . Taylor's theorem with remainder gives
The expressions and mean the operators applied to exact samples. The second-derivative bound comes from the two fourth-order Taylor remainders; the centered first derivative uses two third-order remainders. The one-sided derivative has error at most . Apply the theorem to and : for fixed smooth the centered solution converges at order two as , once , while upwind converges at least at order one. These are upper bounds, not promises that every problem attains the quoted order.
For small , derivatives of the exact solution may grow rapidly. Thus the constants in these estimates may be large; the result does not establish accuracy uniformly in . Upwind has a second exact description.
Concept lensAlgebraic
Upwind as centered advection plus artificial diffusion
Upwind can be rewritten as centered advection with an added diffusion :
This artificial diffusion explains both its monotonicity and the possible smearing of a layer. It is a property of this stencil, not a change in the physical coefficient. In coefficient form, upwind is the centered stencil with replaced by : its own mesh Péclet number is , so the centered sign condition holds automatically.
A resolved formula and an unresolved grid
Worked example 3.4.3
(Exact profile and an overshoot-free upwind value)
Take , , , , , . Integrating the differential equation gives
With , and . The centered single interior equation gives , although both boundary values and the exact solution are nonnegative. The upwind equation gives . It preserves the boundary range here but is still far from the exact midpoint. Monotonicity prevents a spurious negative value; it does not certify accuracy.
For the homogeneous equation with , , the characteristic roots of the centered recurrence are and when . Thus . For , , so signs can alternate between nodes. At this formula is undefined: the stencil instead gives at every interior node, hence there. The case shows why a limiting formula should not be substituted without checking the equation itself.
Counterexample mode
Centered differences beyond $P=1$ violate comparison
Claim: since the centered scheme is second-order consistent, it satisfies the comparison principle on every grid. Take , , , , , and , so and . Then and , that is
Each interior equation checks directly; for instance . The data satisfy and nonnegative boundary values, yet two nodal values are negative and the signs alternate. The hypothesis , which makes the coefficient of nonpositive, cannot be dropped; refining to restores it.
Worked example 3.4.4
(Upwind on the same grid: monotone but smeared)
For the same data, the upwind equations are , with characteristic roots and , so :
All values lie in and increase, as comparison predicts. The exact values are about , and . The upwind value at is more than ten times too large: the artificial diffusion is twice the physical , so the computed layer is far too wide.
Worked example 3.4.5
(The edge case )
Take , , , , and , so . The centered equations become , so and the whole rise happens in the last cell. Comparison holds, and nothing is negative, but the scheme has lost all information about the profile inside the domain. Upwind gives , roots and , so , that is , , . The exact values are about , and . Neither scheme is accurate here: the mesh width is twice the layer width .
Common mistakes
Common mistake
(Formal order does not control a coarse grid)
For any fixed the centered residual is , but the finite grid with above produces . There is no contradiction: the asymptotic statement concerns refinement of the same smooth problem, and the comparison estimate used for the centered scheme requires . Conversely, satisfying prevents this comparison failure but does not by itself guarantee a chosen numerical tolerance. The exact homogeneous solution changes substantially over a length of order near when is large; a mesh must resolve that scale to capture the profile.
Common mistake
(Taking the backward difference whatever the sign of )
The backward difference is upwind only for . For , the scaled stencil has , and its left coefficient becomes positive once . At with , the single interior equation reads : the unknown has disappeared and the system is singular, inconsistent unless . For the upwind difference is the forward one, .
Practice
Quick check
(With , , , , , , , compute both interior values and explain the centered sign condition.)
Solution · Answer
Here and . The centered value is and the upwind value is . The centered neighbor coefficients are nonpositive because ; comparison applies. Neither value is asserted exact.
Quick check
(For the upwind system with zero endpoints and residual , , , bound the nodal error.)
Solution · Answer
The barrier is and has maximum . Comparison therefore gives . This is a bound, not necessarily the actual error.
Quick check
(For , compute and exactly at an interior grid point and compare them with .)
Solution · Answer
The centered first and second differences are and . Hence , exactly the differential expression. The backward first difference is , so . Its residual is , displaying the first-order upwind error.
Quick check
(If , and , find the smallest integer for which the centered comparison theorem applies.)
Solution · Answer
Since , the condition is . Thus is the smallest admissible integer. The condition is sufficient for the stated comparison theorem; it is not an accuracy tolerance or a universal condition for all possible discretizations.