Fundamentals / Numerical mathematics / Numerical partial differential equations

Adjoints and errors in a chosen output

Weight equation residuals by the response of a chosen observation and distinguish algebraic error from mesh error.

From first principles

Derive an output error from an adjoint solve

Consider a nonsingular discrete linear problem \(Au=b\) with approximate solution \(\tilde u\). A user may care about one output \(J(u)=c^\mathsf Tu\) rather than every entry of \(u\). The unknown error \(e=u-\tilde u\) satisfies \(Ae=r\) with residual \(r=b-A\tilde u\). Directly computing \(e\) would require another solve for a complete field. To weight the known residual for this output, select a vector \(z\) whose transposed action reproduces the output coefficients:

\[A^\mathsf Tz=c,\]
\[c^\mathsf T e=z^\mathsf T A e .\]

Substitution yields an exact algebraic output identity and a norm bound:

\[J(u)-J(\tilde u)=z^\mathsf T r,\qquad |J(u)-J(\tilde u)|\le\|z\|_2\|r\|_2 .\]

Large entries of \(z\) identify rows where a residual matters strongly to this particular observable, including possible sign cancellation between rows. A different output requires a different adjoint. The identity concerns error in solving the stated algebraic system. To estimate error relative to a continuum solution, discretization residuals and a suitable continuous or enriched adjoint must also enter.

Derivation and applications

Weight a distributed residual for one point-temperature measurement

A local output need not be equally sensitive to residuals everywhere on the domain. Consider \(-u''=f\) on \(0<x<L\) with homogeneous Dirichlet boundaries and constant unit diffusivity. Suppose a smooth reconstructed numerical field \(\tilde u\) satisfies both boundary values. Define the residual \(r=f+\tilde u''\) so that the error \(e=u-\tilde u\) obeys \(-e''=r\). Seek the error in one output \(J(u)=u(\xi)\) at an interior location \(\xi\).

Introduce a weight \(z\) that solves \(-z''=\delta(x-\xi)\) with zero end values. Away from \(\xi\) the weight is linear, and integrating the equation through the observation point determines its slope jump:

\[z(0)=z(L)=0,\]
\[z'(\xi^-)-z'(\xi^+)=1.\]

Continuity at \(\xi\) and the endpoint conditions determine both linear pieces. They give an explicit tent-shaped influence function

\[z(x)=\begin{cases}x(L-\xi)/L,&x\le\xi,\\ \xi(L-x)/L,&x\ge\xi.\end{cases}\]

Multiply the error equation by \(z\) and integrate by parts on the two intervals. The exterior terms vanish and the unit slope jump isolates the requested point value:

\[J(u)-J(\tilde u)=e(\xi)=\int_0^L z(x)\,r(x)\,dx .\]

A residual near the chosen output can have a larger effect than an equal residual near a prescribed boundary. Residuals of opposite signs can cancel for this observation without producing a globally accurate field. For piecewise linear finite-element fields, the distributional second derivative also contains jumps of the first derivative; omitting those terms would invalidate the identity.

Worked example

Calculate a local temperature error

Take \(L=1\) m and \(\xi=0.250\) m. Suppose \(r=8.00\) K/m² on \(0<x<0.250\) m and zero elsewhere. The relevant weight is \(0.750x\), so the point error is

\[8(0.750)(0.250)^2/2=0.1875\,\mathrm{K}.\]

The positive residual means the exact temperature at the observation exceeds the reconstructed value.

Second application

Move the same residual nearer the far boundary

Put the same \(8.00\) K/m² on \(0.750<x<1.00\) m instead. Now the weight is \(0.250(1-x)\), yielding \(8(0.250)(0.250)^2/2=0.0625\) K. Both residuals have identical \(L^1\) and \(L^2\) magnitude; the first affects this particular sensor three times as strongly. Moving the sensor would change the ranking without changing either residual field.

A residual has a direction

Let \(Au=b\) be an invertible linear discrete model and let \(Q(u)=c^Tu\) report a scalar output, for example a weighted mean temperature. For a computed approximation \(\tilde u\), set \(r=b-A\tilde u\). The error is \(A^{-1}r\), and hence \(Q(u)-Q(\tilde u)=c^TA^{-1}r\). Define the adjoint or dual solution by \(A^Tz=c\). Then the exact output identity is

\[Q(u)-Q(\tilde u)=z^Tr.\]

A single adjoint gives the output effect of many possible residuals. A large residual where the observation has low sensitivity can contribute less than a small residual elsewhere. Opposite contributions can cancel in this particular output, even though they represent substantial state errors.

Compute the weight of each row

Take \(A=\left(\begin{smallmatrix}2&-1\\-1&2\end{smallmatrix}\right)\), \(b=(1,0)^T\), and observe the second unknown with \(c=(0,1)^T\). Then \(u=(2/3,1/3)^T\) and \(z=(1/3,2/3)^T\). For \(\tilde u=(0.6,0.3)^T\), the residual is \((0.1,0)^T\). Its weighted sum is \(1/30\), exactly the missing part \(1/3-0.3\). If a solve produced residual \((0,0.1)^T\) instead, the same residual norm would double the output error. This output cares twice as much about the second row as about the first.

For residual \((0.2,-0.1)^T\), the signed estimate is exactly zero. The sum of absolute contributions is \(2/15\), an upper bound insensitive to cancellation. An analyst interested only in the selected output can accept a calculation whose state vector another observer would reject. Specify the observation before choosing stopping and refinement criteria.

Move from an algebraic error to a mesh error

An accurately solved finite-element system has almost zero algebraic residual in its own discrete test space. It can still differ from the continuum solution. Let \(a(u,v)=\ell(v)\) be the continuum weak equation and define \(R(v)=\ell(v)-a(u_h,v)\). For a linear observation the continuum dual satisfies \(a(v,z)=Q(v)\), giving \(Q(u)-Q(u_h)=R(z)\). Galerkin orthogonality means \(R(z_h)=0\) for every test function on the same mesh, hence \(R(z)=R(z-z_h)\).

Estimating this term requires a dual approximation richer than the test space used for the primal solve, or an independent reconstruction. Integrating element residuals by parts can expose both cell defects and jumps in normal flux. Weight these local contributions by the unresolved dual variation to discover which regions can affect the output strongly. Check an estimated correction against actual output changes on a refined mesh; a poor dual approximation can misidentify important regions even when the primal residuals have been evaluated exactly.

Compare a point observation with an average

In the two-unknown example, replace the second-node observation by the mean \(c=(1/2,1/2)^T\). The constant vector is an eigenvector of \(A\) with eigenvalue one, so the adjoint becomes \(z=c\). A purely antisymmetric residual \((0.1,-0.1)^T\) makes the mean output error zero. For the earlier second-node output the same residual gives \(-1/30\). A mesh designed to resolve an average can therefore allocate effort differently from one designed for a single sensor. Whenever a reported error changes markedly between observables, inspect the dual weights before attributing the change to a flaw in the physical simulation.

Turn primal and dual approximation errors into an output bound

For a symmetric coercive bilinear form \(a\), let the exact state \(u\) satisfy \(a(u,v)=\ell(v)\), and the exact dual \(z\) satisfy \(a(v,z)=Q(v)\) for a linear output \(Q\). With conforming Galerkin approximations on the same trial space, \(a(u-u_h,v_h)=0\) for every discrete test. Consequently \(Q(u)-Q(u_h)=a(u-u_h,z-z_h)\). Cauchy–Schwarz in the energy inner product gives an absolute bound by \(\|u-u_h\|_a\|z-z_h\|_a\). Accuracy of either the state or the observation sensitivity can separately make the output error small.

When the primal and dual energy errors both decrease proportionally to \(h\), their product guarantees an \(O(h^2)\) output error under these assumptions. It does not guarantee second order for every possible observation. A point evaluation in a higher-dimensional continuum problem may be unbounded on the energy space or yield a dual solution with a strong singularity. Then the dual error may converge much more slowly. Likewise nonconforming approximation, inexact integration or inconsistent boundary terms introduce additional residual terms that are absent from the simple Galerkin cancellation.

A case where the product bound is exact

Let \(a(v,w)=v^TAw\) with \(A=\operatorname{diag}(2,8)\), exact state \(u=(1,2)^T\), and reduced approximation space spanned by \(s=(1,1)^T\). The Galerkin coefficient is

\[(s^TAu)/(s^TAs)=(2+16)/10=1.8.\]

Choose output \(Q(v)=(6,8)v\); its exact dual is \(z=(3,1)^T\) since \(Az=(6,8)^T\). Projecting that dual onto the same space gives coefficient \((6+8)/10=1.4\). The primal and dual errors are therefore \((-0.8,0.2)^T\) and \((1.6,-0.4)^T\).

Their energy inner product is

\[2(-0.8)(1.6)+8(0.2)(-0.4)=-3.2.\]

Direct evaluation gives \(Q(u)=22\) and \(Q(u_h)=25.2\), confirming the signed error exactly. Squared energy errors are

\[2(0.8)^2+8(0.2)^2=1.6,\]
\[2(1.6)^2+8(0.4)^2=6.4.\]

Their square-root product is 3.2, attaining the absolute bound because the two error vectors are antiparallel. The bound cannot determine the sign; the signed dual residual can.

Replace the observation by \(Q_2(v)=(2,8)v\). Its exact dual is \(s\), already representable, so \(z-z_h=0\) and the output error vanishes even though the state error is unchanged. Indeed \(Q_2(u)=18=Q_2(u_h)\). A mesh judged solely by that particular observable could look exact. A different sensor weighing the same simulation states produces a demonstrably nonzero output error, which is why adaptive refinement objectives should name their actual observations.

If the approximate dual used the same one-dimensional space and one simply evaluated the primal residual on it, the reported correction would be exactly zero for either output. The first observation shows that such a number can be badly misleading. An enriched dual must include a direction outside the primal test space; in this two-coordinate example, adding either coordinate direction gives the full space and recovers the signed error exactly. On a fine physical mesh full enrichment may be too expensive, making local higher-order reconstruction or an independently refined dual mesh attractive. The product bound then clarifies which additional error in the dual approximation needs to be controlled.

It also identifies the observation for which refining the primal mesh alone is unnecessary.

Bound the uncertainty of an approximate dual correction

A practical enriched dual \(\tilde z\) may itself have numerical error. In the symmetric positive definite algebraic setting the difference between true output error and its estimated correction is \((z-\tilde z)^Tr\), where \(r=b-Au_h\). With dual residual \(r_z=c-A\tilde z\), this equals \(r_z^TA^{-1}r\). Cauchy–Schwarz bounds its magnitude by \(\|r_z\|_{A^{-1}}\|r\|_{A^{-1}}\). This identity explains why a small ordinary residual norm can be insufficient for either the primal or dual solve: directions associated with small eigenvalues receive greater weight in the inverse-energy norm.

In the preceding example choose \(\tilde z=(2.5,1)^T\). The primal residual is \((-1.6,1.6)^T\); the approximate correction is therefore \(-4+1.6=-2.4\), moving the coarse output 25.2 to 22.8. The actual output is 22, leaving error −0.8 after correction. The dual residual is \((1,0)^T\), with squared inverse-energy norm \(1/2\). The squared primal residual norm in the same metric is 1.6. Their product of norms is \(\sqrt{0.8}\approx0.8944\), containing the observed remaining discrepancy. For larger problems, estimating these norms can itself require a separate bound or preconditioner. Reporting only the corrected value without assessing the accuracy of the dual can make a visually improved output appear more certain than the calculation warrants.

Which source errors matter to a point measurement?

For \(-u''=f\) with zero values at both ends of the unit interval, seek the sensitivity of \(u(a)\) to a point load. The adjoint is piecewise linear, vanishes at the endpoints, is continuous at \(a\) and has derivative jump minus one.

Which source errors matter to a point measurement?. Horizontal axis: Source location. Vertical axis: Change in measured u per unit point source. Data follow the figure.
For a sensor at 0.25, an equal positive source error at 0.25 has three times the effect of one at 0.75. Opposite-signed local residuals may cancel in the target output, even when their unweighted norm is appreciable.
Read values from the plot
Change in measured u per unit point source at selected values of Source location.
Source locationSensor at 0.25Sensor at 0.5Sensor at 0.8
0000
0.250.18750.1250.05
0.50.1250.250.1
0.750.06250.1250.15
1000

Download all 301 plotted samples (CSV)

Change parameters · Which source errors matter to a point measurement?

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.