1. Errors and residuals
A solver can finish before your question is answered
Section titled “A solver can finish before your question is answered”Imagine predicting the temperature at the middle of a rod. The linear solver reports a tiny residual. That tells you something about a system of algebraic equations; it does not yet say whether the mesh resolves the temperature or whether the conductivity describes the material.
We will distinguish these questions using one matrix and one executable Poisson experiment. You need matrix multiplication and the idea of a vector length. The heat-transfer book supplies the physical interpretation if you want one.
Follow the approximations
Section titled “Follow the approximations”Let solve the continuous mathematical problem, solve its discretized equations exactly, and denote the field reconstructed from the computed coefficients. Then
The first term is spatial approximation error. The second includes incomplete algebraic solution and rounding. Neither term measures the difference between the mathematical model and the physical world.
| Source of discrepancy | A controlled investigation |
|---|---|
| Physical assumptions | Compare a neglected effect with the retained balance |
| Uncertain input | Vary that input within a justified range |
| Spatial approximation | Refine the mesh with the model and solver policy fixed |
| Temporal approximation | Change time accuracy while keeping the spatial problem fixed |
| Algebraic iteration | Tighten the stopping tolerance on the same mesh |
| Floating-point arithmetic | Examine scaling and sensitivity; refine with care |
These are different experiments. Refining a mesh cannot fix the wrong heat source, and tightening a solver cannot add missing spatial degrees of freedom.
What a residual measures
Section titled “What a residual measures”For , define the residual of a computed coefficient vector by
Subtraction gives , hence when is invertible. Taking compatible norms yields
for nonzero . The condition number describes how strongly residuals can be amplified into coefficient errors. Scaling and stopping criteria therefore matter together; see Barrett and coauthors’ discussion of stopping criteria.
A small residual with a large error
Section titled “A small residual with a large error”Take
Then , although one component of the solution is completely wrong. In the infinity norm, the relative residual is and the relative error is . Here , so the bound is attained. This is an arithmetic example, not a claim about the conditioning of every Eqiora problem.
If the two unknowns represent quantities with different units, a raw vector norm may itself be meaningless. Choose physical reference scales first: for example, measure temperature error relative to a chosen temperature difference.
Compute a spatial comparison
Section titled “Compute a spatial comparison”From the eqiora-source checkout created in Get started, run:
cargo run -p eqiora-numerics --example poisson_convergenceThe maintained comparison program solves with zero endpoint values on the unit interval. Before inspecting its table, differentiate twice and check the boundary values. That gives a solution independently of the numerical output.
Read the fem_l2 and fvm_l2 columns as field errors, and the two balance
columns as conservation discrepancies. Their magnitudes need not be similar:
a method can balance its source and boundary flux almost exactly while its
field remains visibly approximate. The following lessons derive both methods
and explain precisely which field each error measures.
The program already performs assembly and the linear solve. You do not need to build a separate solver to examine the mathematics. Open its source to see where the model is loaded and where the mesh counts enter the comparison.
A misleading improvement
Section titled “A misleading improvement”Suppose one run uses 16 cells and a relative solver tolerance of ; another uses 32 cells and . A smaller field error in the second run does not isolate spatial convergence: two controls changed. First compare tolerances on the 16-cell problem, then compare meshes using an adequately tight common tolerance.
Conversely, a flat error curve under mesh refinement may mean algebraic error has become dominant. It can also mean a wrong comparison function or norm. Identify which hypothesis a follow-up run would distinguish.
Exercises
Section titled “Exercises”- Replace by in the matrix example. Recompute the residual, condition number, and error without a solver.
- Let . Explain why residual and coefficient error now agree, and why this still says nothing about spatial discretization error.
- In the Poisson output, find a row with a small balance discrepancy and a larger field error. Explain how both can be correct.
- Design three runs that distinguish a solver-tolerance plateau from spatial error. State what stays fixed in each comparison.