From first principles
Derive the observed order and an extrapolated continuum output
Verification compares the discretized problem against a known solution or controlled refinement. Choose one scalar output \(Q\), the same geometry and the same physical observation point on each mesh. Assume a smooth leading error \(Q_h=Q+C h^p+o(h^p)\) on geometrically similar meshes, with refinement ratio \(r>1\). Subtract successive estimates to remove the unknown continuum output:
Their ratio approaches \(r^p\), provided the leading coefficient is nonzero. Solve for the order, then use the finest pair to remove the leading error term:
The ratio is meaningful only when a consistent leading error dominates. Differential changes of solver tolerance, geometry or timestep across the meshes can contaminate it. A manufactured solution independently tests discretization and boundary terms by inserting a chosen exact field into the differential operator and supplying the resulting source.
Background · Observed convergence order
Errors must refer to the same observable and norm. Cancellation, singular boundaries and a reference solution of insufficient accuracy can distort the result.
Derivation and applications
How the measured norm changes an observed convergence rate
A verification study may report very different rates for the same discrete field. Choose a fixed one-dimensional domain of length one, divided into cells of width \(h\). Suppose the solution is smooth away from an interface, where a nearby discontinuity, boundary approximation or reconstruction produces a localized error. Let the error magnitude be \(A h^\alpha\) on a fixed number \(m\) of cells near the interface, and at most \(B h^p\) elsewhere. The count \(m\) stays fixed under refinement. For a finite \(q\ge1\) use the physically weighted norm instead of an unweighted vector norm:
As \(h\) decreases the term with the smaller exponent decays more slowly. If the indicated leading magnitudes are actually attained, the corresponding rate of the norm is
The extra \(1/q\) comes from the shrinking physical measure of the affected region. It disappears in a maximum norm. A single signed integral of error can give still another result because opposite local errors cancel:
A convergence statement therefore requires the reported norm, physical location, and mesh sequence. If an interface stays at a changing subcell position as the grid is refined, the leading coefficient can vary; observed slopes from just two grids can then be misleading.
Worked example
Calculate three norms for a displaced step
Let one cell of a piecewise-constant reconstruction differ from the exact field by \(1.00\), with zero error elsewhere. At \(h=1/64\), the \(L^1\) error is \(1/64=0.015625\), the \(L^2\) error is \(\sqrt{1/64}=0.125\) and the maximum error is \(1.00\). Refining to \(h=1/256\) gives \(0.003906\), \(0.0625\) and \(1.00\). The measured rates are one, one half and zero for precisely the same displacement.
Second application
Compare cancellation with local accuracy
Suppose two adjacent cells at \(h=1/100\) have errors \(+0.500\) and \(-0.500\). The signed integral discrepancy is zero; the \(L^1\) error is \(0.0100\) and the \(L^2\) error is
Checking only total inventory would certify the output but miss the incorrect distribution. A local measurement or absolute-error norm verifies a different and often more demanding quantity.
OneSimulation laboratory
Predict grid error from the wavelength
Can a solver satisfy every discrete balance to roundoff and still overpredict the field? Consider a unit square with zero values on all four sides and a uniform diffusion coefficient. Prescribe the continuous field \(u=\sin(ax)\sin(ay)\) with \(a=m\pi\) and integer \(m\). Differentiating it twice in each direction gives the source \(f=2a^2u\) for \(-\nabla^2u=f\). This constructs a known solution before any numerical calculation.
Predict the grid’s response. For an evenly spaced line with interval \(h=1/N\), add the two neighbouring values of a sampled sine using the angle addition rule. The negative second difference in one direction becomes a multiple of the original sample:
The square contributes the same factor twice. Its discrete eigenvalue is \(\lambda_h=8\sin^2(ah/2)/h^2\). Since the source was constructed with the continuous eigenvalue, the grid solution is \(u_h=(2a^2/\lambda_h)u\) at the nodes. Expanding the sine gives the amplitude ratio \(1+(ah)^2/12+O((ah)^4)\). At a fixed mode, halving the mesh spacing should reduce the leading amplitude error fourfold.

Read the comparison. For mode 2, refinement from 24 to 48 cells per side changes the largest nodal error from 0.005731 to 0.001429. The ratio is 4.01. Compare modes at a common mesh size to see why a smooth but shorter-wavelength field can be harder to resolve. The prediction evaluates the maximum on the actual nodes because some grids miss the continuous peaks.
Try a different wavelength. Choose mode 4 on 16, 32 and 64 cells. Compare the output with mode 2 on 8, 16 and 32 cells. These pairs have the same number of cells per half-wave. Predict which error values carry over.
Further reading · Gilbert Strang, Difference matrices and eigenvalues, §5.5 (PDF).
Download the OneSimulation model (Python). Set up the local runtime, then run the downloaded file:
python poisson-mode.py --mode 4 --cells 16 32 64OneSimulation laboratory
Measure spatial convergence on a known field
Start from this chapter. Predict an error ratio of four for second-order spatial accuracy when both grid spacings halve. Compare three meshes at the same sine mode, then test a shorter wavelength.
Compare recorded OneSimulation runs on this page. To test your own inputs, download the Python model and run the model in an activated OneSimulation environment.
The script solves the steady equation \(-\nabla\!\cdot[(1+x)\nabla u]+2u=f\) on the unit square by conservative flux differences and Jacobi-preconditioned CG. Set \(u=\sin(m\pi x)\sin(m\pi y)\) and obtain the source by substitution. The boundary values are zero on all four sides. Compare the maximum error at grid nodes with the solver’s relative residual. Refine both axes together, then raise the sine mode on the same 48-cell mesh to see how wavelength affects the error. Download the Python experiment · OneSimulation reaction–diffusion refinement study.
python partial-differential-equations.py
python partial-differential-equations.py --cells 48
python partial-differential-equations.py --cells 96
python partial-differential-equations.py --cells 48 --mode 2
| Cells per axis, mode | Interior unknowns | Max. nodal error | Relative residual |
|---|---|---|---|
| 24, 1 | 529 | 1.33345 × 10⁻³ | 9.79 × 10⁻¹¹ |
| 48, 1 | 2,209 | 3.33763 × 10⁻⁴ | 7.14 × 10⁻¹¹ |
| 96, 1 | 9,025 | 8.34283 × 10⁻⁵ | 4.21 × 10⁻¹¹ |
| 48, 2 | 2,209 | 1.41546 × 10⁻³ | 8.89 × 10⁻¹¹ |

At mode one the error falls by factors close to four while the number of interior unknowns roughly quadruples. On the same 48-cell mesh, mode two has half as many intervals per wavelength and a larger error. Both modes have small algebraic residuals. Mesh convergence is a property of the resolved field and its discretisation.
Change parameters · Change the laboratory inputs
Change one input at a time and compare the recalculated curves with the argument above. The browser evaluates this small model locally; the accompanying numerical values state its assumptions and reference checks. Reset restores the reference inputs, and the data can be downloaded as CSV.
Problem sheet 3 · Predict the error before making a finer grid
Build a test with a known answer
Consider \(-\nabla\cdot(D\nabla u)+\kappa u=f\) on the unit square. Select the exact field \(u_\star=\sin(\pi x)\sin(\pi y)\) and prescribe its value at the boundary. Now choose \(D=1+x\), \(\kappa=2\), using coordinates normalised to a metre. Differentiation gives
The required source is therefore
The derivative of \(D\) is essential: inserting only the local value of \(D\) times the Laplacian specifies a different differential equation. Manufacturing a source tests whether the code solves the stated model and boundary conditions. Experimental validation asks a separate question about fidelity to physical observations. A polished plot resembling the exact field does not substitute for a numerical error measure with defined sample positions and units.
Read a three-grid study
On successively halved mesh spacings suppose the error in one norm follows \(E_h=C h^p+o(h^p)\). Taking ratios gives
Three grids provide two such estimates, indicating whether a consistent asymptotic trend is present. A single ratio may result from cancellation between terms of different order. State the norm, grid location, geometry representation, time step if applicable, and the residual tolerance. Comparing a cell average on one grid with a nodal peak on another can produce a meaningless rate.
For the variable-diffusion square, maximum nodal errors at 24, 48 and 96 intervals per axis are approximately \(1.33345\times10^{-3},3.33763\times10^{-4},8.34283\times10^{-5}\). The observed orders are approximately 1.998 and 2.000. The finest-grid algebraic residual is already far below the field error in its respective normalisation. Tightening the iteration tolerance alone will not remove the leading spatial defect. Raising the sine mode while holding the mesh fixed increases derivatives of the exact solution and tests a different resolution regime. Inspect the grid and mode experiment.
Decide where further resolution matters
A manufactured sine is smooth everywhere. Actual domains may contain a re-entrant corner, a material jump or a narrow source. Derivative bounds used in theoretical convergence estimates can fail locally there. Uniformly halving a two-dimensional mesh roughly quadruples the cell count while spending most new cells away from a localised feature. Local refinement attempts to concentrate new degrees of freedom where they matter to a chosen output. Which cells merit refinement depends on the equation, boundary data and the output being measured.
For a conforming finite-element approximation, one class of error indicators combines an element residual with jumps in normal flux across interior faces. The residual tests whether each element satisfies the differential balance, while the jumps measure disagreements between neighbouring reconstructed fluxes. In a constant-coefficient Poisson example, a piecewise linear solution can have zero elementwise Laplacian even when it bends globally; the slope changes then appear at interelement faces. An indicator using only the interior derivative would miss this information. Mesh-length factors and coefficient weights are necessary to combine the terms in a specific norm.
Finish a refinement study by tracking the physical observable itself. If the objective is integrated heat flow, a changing maximum pointwise gradient near one corner may have little influence on that integral. Conversely, apparently stable domain averages can hide an unresolved peak. Report observed change with resolution and an independent balance or analytic check, specifying exactly which quantity has been verified.
Choose cells to refine from residuals and flux jumps
A mesh-convergence table needs several complete solutions. To spend the next refinement locally, examine the equation that the present field still fails to satisfy. For \(-u''=f\) with zero Dirichlet endpoints, let \(u_h\) be its conforming piecewise-linear Galerkin solution. Integrating the error equation by parts on each cell \(K\) gives
The sum over \(z\) includes interior nodes only. Even when the cell derivative is constant and \(u_h''=0\) in each open cell, its jumps measure failures of flux continuity. Dropping these terms would miss part of the weak residual. Galerkin orthogonality lets us substitute \(v-I_hv\) for \(v\), where \(I_hv\) is a local conforming approximation. Local interpolation and trace estimates supply the mesh-length factors in an indicator. One conventional allocation on a uniform mesh is
The half shares a node between its two neighbors. An upper bound on the energy error involves the square root of the summed indicators and a mesh-independent constant. Efficiency estimates can also involve unresolved variations in the load. The indicator is a refinement criterion, not a measured cell error.
Spending one refinement near a source
On the two half-intervals let \(f=0\) on the left and \(f=4\) on the right. The central hat function integrates to \(1/4\) on the right, so the interior load is \(1\). Its stiffness is \(4\). The central temperature is \(1/4\). The cell slopes are \(1/2,-1/2\), so \(J=1\). The jump contributes \(1/4\) to each indicator squared. The source contributes zero on the left and \((1/2)^2(16/2)=2\) on the right. Thus the right cell accounts for \(2.25/2.5=90\%\) of the total. A bulk-marking rule targeting at least \(75\%\) marks this one cell.
An exact check explains the distinction between indicator and error. Integrating the differential equation gives the exact slope \(1/2\) throughout the left cell and \(1/2-4(x-1/2)\) on the right. The true squared energy error is zero on the left and \(\int_0^{1/2}(1-4s)^2ds=1/6\) on the right. The indicator assigns some weight to the neighbor because both cells share a flux jump. Its largest contribution nevertheless identifies the curved part of the field.
Practise on sheet 3 · Refine a three-cell source patch. Further reading · Heidelberg University · Lecture Notes on Scientific Computing with Partial Differential Equations · §9.2 Residual-based a-posteriori Error Estimator and §9.3 Local Mesh Adaptation.
Check refinement at an identical location
Suppose a displacement is reported at the centre of a square. On an even grid that point may coincide with a node, whereas on an odd grid it can lie at the centre of a cell. Taking the maximum over mesh nodes produces a different sample on each grid. A refinement curve can then combine field discretisation error with the movement of the evaluation point. Choose a fixed physical point and evaluate each solution there with its own consistent interpolation, or compare a well-defined integral over the same physical region.
Similarly, compare gradients on compatible supports. Nodal averages of element stresses can look smoother than the individual element values, yet smoothing can alter extrema and convergence rates. Record the native support and any recovery operator. This makes an apparent improvement reproducible and gives students enough information to explain a discrepancy between two otherwise credible simulation reports.
Separate space and time with a crossed refinement study
Suppose a reported output has asymptotic error \(Q(h,k)-Q_\star=A h^p+B k^q\) plus smaller terms, with spatial spacing \(h\) and time step \(k\). Refining both coordinates in a fixed relation examines only one line across this two-dimensional error surface. Opposite signed contributions can cancel on that line. A genuine spatial order check uses several \(h\) at fixed sufficiently small \(k\), and a temporal check uses several \(k\) at controlled \(h\). When exact values are available, the individual error signs provide particularly clear evidence of cancellation.
A small crossed design with coarse and fine settings in both directions already offers a structural test. Denote its four outputs by \(Q_{cc},Q_{cf},Q_{fc},Q_{ff}\), with the first subscript indicating the spatial mesh. For an additive leading error the spatial change \(Q_{cc}-Q_{fc}\) equals \(Q_{cf}-Q_{ff}\). Their difference, \(Q_{cc}-Q_{cf}-Q_{fc}+Q_{ff}\), measures a mixed contribution or departure from the leading separated model. A small difference supports that model over the tested settings but cannot prove that the assumed orders are correct; additional refinement levels are needed to estimate orders from the data.
Recover a hidden temporal bias from four runs
Take a manufactured output \(Q=10+2h^2-k\). The benchmark value is ten. Choose \(h_c=0.2,\ h_f=0.1,\ k_c=0.1,\ k_f=0.05\). The four outputs are respectively \(9.98,\ 10.03,\ 9.92,\ 9.97\). At either time step, halving the spatial mesh reduces the output by 0.06. At either spatial mesh, halving the time step increases the output by 0.05. The mixed difference is zero. Refining both together moves the value by only −0.01, concealing spatial and temporal changes five or six times larger.
If the orders are independently known as \(p=2,\ q=1\), the fine-grid spatial bias is
The fine-time bias is
Subtracting both from the fine result gives \(9.97-0.02+0.05=10\), exactly recovering the limit in this idealised expansion. Choosing instead \(k=2h^2\) on every paired run would return exactly ten for every mesh, including a very coarse one. A convergence plot along that line would demonstrate cancellation rather than independent verification.
Explicit stability restrictions can make unrestricted crossing impractical. If a coarse time step is unstable on the finest spatial grid, choose a stable common range or use an implicit reference to isolate spatial error. Keep output locations, boundary representation and integration tolerances consistent across the crossed study, since changes in those other approximations can also enter the mixed difference.
A fifth run can interrogate the assumption that the fine-grid spatial change is asymptotic. At \(h=0.05,\ k=0.05\) the manufactured output is 9.955. The change from 9.97 is 0.015, one quarter of the earlier spatial change 0.06 at the same time step. This independent ratio supports \(p=2\) for the tested family; it does not distinguish a true zero cross term from a smaller mixed term below the numerical resolution.
Resolve a second spatial frequency on the same grid
Set the exact field on the square to \(\sin(m\pi x)\sin(m\pi y)\) and manufacture the corresponding source for diffusion coefficient \(1+x\) and reaction coefficient 2. Run the downloadable OneSimulation model with m = 1 and 2 on each grid. The boundary data agree, while the source and the exact interior curvatures change.

Read values from the plot
| Uniform intervals per axis | 1 half-wave per axis | 2 half-waves per axis |
|---|---|---|
| 8 | 0.012068 | 0.052561 |
| 16 | 0.0030008 | 0.012829 |
| 24 | 0.0013335 | 0.0056768 |
| 32 | 0.0007509 | 0.0031883 |
| 64 | 0.00018768 | 0.00079605 |
Download the OneSimulation model (Python)
Change parameters · Resolve a second spatial frequency on the same grid
Change one input at a time and compare the recalculated curves with the argument above. The browser evaluates this small model locally; the accompanying numerical values state its assumptions and reference checks. Reset restores the reference inputs, and the data can be downloaded as CSV.
Study the full derivation
Bound diffusion error by balancing a reconstructed flux · Spatial discretisation and field equations
A temperature field from a finite-element calculation looks smooth. Reconstruct a heat flux which exactly balances the source, then derive an upper bound for the true energy error without knowing the exact temperature.