Improve · Gradient verification

Sensitivity analysis with gradients checked before they steer a design

A wrong adjoint gradient does not crash. The optimiser converges, the history plot looks healthy, and the design walks confidently in the wrong direction. The TensorLynx platform tests each gradient route against noise-sized finite differences on two independent directions, fits the Taylor remainder, and withholds a route that fails before any optimiser may use it.

Bars fixed before the first measurementTwo random directions, never oneUnresolved reads Unknown, never Pass

Schematic: on the contours of an objective, an unchecked gradient drifts away from the minimum while a checked gradient, aligned with finite differences at a gate, descends to it minimum unchecked gradient checked gradient gate: finite differences × 2 Taylor order ≈ 2 · bars frozen adjoint finite difference
Schematic A drawing of the idea, not data.

The cost of the old way

One missing term, five times the wrong answer, no error message

On one duct family, the sensitivity of pressure drop to its throat parameter came out three ways. The adjoint read on its own, without the chain through mesh movement, gave −48.42 Pa per unit. A same-mesh central finite difference gave −240. The adjoint carried through the mesh chain gave −242.9, within 1.22 % of the reference. Measured duct shape family, recorded benchmark

Every solve converged; no residual plot separates the first number from the third. An optimiser fed the first sees a fifth of the true sensitivity, while other parameters are wrong in their own ways, so the direction itself turns.

  • Checking is skipped because it is expensive. Two solves per variable, times hundreds of shape variables.
  • The step is a guess. Too large and truncation dominates; too small and solver noise does.
  • One direction hides the failure. It cannot tell a scale error from a gradient pointing elsewhere.
  • The cosine flatters. A gradient uniformly twice too large has a cosine of exactly 1 and sends every line search to twice the right step. Method
Parity plot of adjoint against finite-difference sensitivity for the throat parameter: the adjoint without the mesh chain sits far from the diagonal at minus 48.42; carried through the mesh chain it moves onto the diagonal at minus 242.9 against minus 240 −260 −130 0 −260 −130 0 adjoint dJ/dp, Pa per unit finite difference perfect agreement −48.42 · no mesh chain −242.9 · through the chain FD −240 · 1.22 %
Measured Throat parameter of a duct shape family, Pa per unit.Axes to scale.

How TensorLynx does it

A gradient earns its way into the optimiser

The adjoint optimisation chapter computes one gradient for every surface point at the price of one extra solve. This chapter decides whether that gradient is allowed to move the design. Five steps, run before the optimiser starts.

01

Fix the bar before measuring

Every bar is declared with its rationale and a cited reference before the first gradient is computed, and never moved afterwards. The direction bar admits about 18 degrees, which a line search absorbs, and cautions down to 37, which it does not. Method

02

Measure the noise, then size the step

An iterative solver’s objective carries noise. The platform estimates that floor and sizes the finite-difference step to it, after Moré and Wild. A parameter whose whole effect sits below the floor is reported unresolved, not judged.

03

Probe two independent random directions

The projected gradient g·d is compared with a finite difference along two random directions. Equal ratios mean a scale error: the sign holds and the step still descends. Ratios that differ or flip sign mean an error as large as the gradient. No scaling repairs that.

04

Fit the Taylor remainder

If g is the true derivative, the remainder J(x+hd) − J(x) − h g·d shrinks with h2; if it is not, with h, whatever its size. The fitted order is read only over steps where the remainder stands at least three times above the noise floor, because the order of noise is not an order.

05

Label it, route it, keep the record

A passing check labels the gradient Direction-checked (usable for optimisation), never “verified”. A failing route is withheld and the router falls back to finite differences while 2n solves fit the budget, or refuses and names both costs. A failed check stays on the result, with its run id.

The five steps of a gradient check: frozen bars, a noise-sized step, two random directions, the Taylor remainder test and the final label Bars, declared first Direction · cosine 0.80 0.95 1 Magnitude · regression slope 0.90 1 1.10 Correctness · Taylor order 1 · wrong 2 · right ■ pass ■ caution outside: fail Noise first, then the step step h (log) |ΔJ| (log) measured noise floor noise-sized step h* effect below the floor: refused, unresolved Two random directions ratio g·d / FD 1 d₁d₂ equal: scale error, still descends ratio g·d / FD 10 d₁d₂ differ or flip: unusable Taylor remainder step h (log, halving to the left) R₀ ∝ h · slope 1 R₁ ∝ h² · slope 2 fitted order ≈ 2 Verdict, label, route resolvable above the reference’s noisePASS direction · cosinePASS magnitude · slopePASS correctness · Taylor orderPASS unresolved reference → UNKNOWN, never PASS Direction-checked (usable for optimisation) route withheld → finite differences if 2n solves fit, else a refusal that names both costs

Inside the engine

The arithmetic behind each verdict

For the analyst who signs the study: what is measured, and why each bar sits where it does.

The V of truncation and round-off

A central difference carries truncation error falling with h2 and cancellation error growing as εJ/h, where εJ is the objective’s noise. Their sum is a V on log-log axes; agreement exists only in its trough. An iterative solver’s εJ sits far above machine precision, so a default step can land on either wall.

The complex step, f′ ≈ Im f(x + ih)/h, has no subtraction and so no rising wall. Where a code path supports complex arithmetic it is the sharper reference: the platform’s free-form-deformation geometry Jacobians match it to 4.5e-16 Measured. Flow-solver gradients are checked against noise-sized central differences.

Schematic log-log plot of finite-difference error against step size: truncation error falls with the square of the step, round-off rises as the step shrinks, the total forms a V with its trough near 1e-3.4; the complex step keeps falling to machine precision 1e-121e-61 1e-11e-81e-16 step h round-off truncation sweet spot complex step
Schematic Model curves, not solver data. Hover or focus the markers.

Direction. cos θ = g·gFD / (‖g‖ ‖gFD‖). If the error obeys ‖e‖ ≤ ε‖g‖ then cos θ ≥ √(1 − ε2); a usability threshold of ε = 0.15 follows from that arithmetic.

Magnitude. The regression slope of the reference on the adjoint, the statistic the cosine cannot see.

Correctness. R0(h) = |J(x+hd) − J(x)| = O(h); R1(h) = |J(x+hd) − J(x) − h g·d| = O(h2). The median R1/R0 sizes the systematic directional error the order only detects.

Method Bars as declared in the platform’s rule set, each with a cited reference.
CheckPassCautionWhy there
Resolvabledisagreement above the reference’s noise—Otherwise Unknown: wrong adjoint and noisy reference are indistinguishable.
Cosine≥ 0.95≥ 0.8018° is absorbed by a line search; 37° is not.
Regression slope1 ± 0.101 ± 0.25Catches a gradient uniformly too large or too small.
Taylor order2 ± 0.22 ± 0.5Beyond 0.5, second order and first blur.
Systematic error R1/R0≤ 5 %≤ 15 %15 % is where a gradient is merely usable for optimisation.
Adjoint convergence≥ 4 decades—One stalled adjoint equation spoils the sensitivity it feeds.
Adjoint vs primal shortfall≤ 2 orders≤ 3 ordersPrimal down six orders, adjoint down two: a confidently wrong gradient.
Gradients used as training labelscosine ≥ 0.99≥ 0.95A regression has no line search to absorb a direction error.

A gradient is a chain, and each link is named

dJ/dp runs from the objective through the flow adjoint and surface sensitivity, through mesh movement, to a CAD or free-form-deformation parameter. The platform names every route and the mesh mover it assumes, and admits it only when the forward run’s mover matches. A mixed chain, or a remeshed forward run, is refused by identity before any number is computed.

Each route is gated on a resolvable laminar twin of its case: same mesh, markers and objective, solved to round-off. Where the reference cannot resolve, the gate reads Unknown. A gradient is tied to its rank count and solver build; change either and the check is due again.

The router. Finite differences while 2n solves fit the budget; beyond it an admitted adjoint; otherwise a refusal that names both costs. On one turbulent duct case, a gradient run took 544 s against 40 s for a primal, so the crossover sat near seven variables. Measured

The chain of a shape gradient: objective, flow adjoint, surface sensitivity, mesh movement, design parameter; a mover mismatch breaks the chain and is refused objective J flow adjoint · ∂J/∂mesh surface sensitivity mesh movement · named mover design parameter p
Schematic Focus a link for detail.

Local tells you which way; global tells you what matters

An adjoint gradient answers a local question: which way to move from this design. Variance-based indices answer a global one across the box. The first-order index Si is the share of output variance one input explains alone; the total index STi adds its interactions. Morris screening ranks inputs cheaply by mean absolute elementary effect.

The Ishigami test function shows why both matter: its third input explains nothing alone and a quarter of the variance through interaction. A one-at-a-time study would discard it.

Thousands of evaluations make these indices a surrogate calculation. OLTRION’s discipline: the surrogate passes its fit verdict before any index is computed, and every index is labelled as a statement about the surrogate. That is the hand-off to trust-aware surrogates.

Closed-form Sobol indices of the Ishigami test function: input 1 first-order 0.314, total 0.558; input 2 first-order 0.442, total 0.442; input 3 first-order 0, total 0.244 00.30.6 x₂ x₁ x₃interaction only first order S₁ total ST
Method Closed-form indices of the Ishigami function (a = 7, b = 0.1), a published test case, not TensorLynx data.

Evidence you can check

Second order where it should be, and a miss that stopped a route

Every figure below comes from a recorded verification run, judged against bars declared before it.

Fitted Taylor orders from recorded gradient checks, all inside the pass band around 2: structural compliance derivative 1.99, solver conformance kit 1.97 to 2.04, thermal adjoint 2.02, 2.01 and 2.02, turbulent duct adjoint 2.01, 2.00 and 2.00. A wrong gradient would sit at 1. 1 · wrong gradient pass 1.8–2.2 1.01.52.02.5 fitted order of the Taylor remainder structural conformance thermal turbulent duct
Measured Recorded verification runs. Focus a row for its numbers.
Measured Route gates against central finite differences.
CaseCosineNorm ratio
Pipe bend, surface route, laminar twin0.99999999521.0000734
Duct, CAD-parameter route, laminar twin1.00000000001.0000000
Duct, turbulent, wall functions0.999999991.00020
Duct, thermal adjoint (heat flow), laminar twin0.99999999900.99999
Structural compliance derivative1 − 1.2e-12—

A 0.15 % miss stopped a route

A mesh-warping adjoint route missed its gradient-norm band by 0.15 %. It was withheld and the router used finite differences. The cause: a derivative term that vanished exactly at the rest shape. Fixed, the turbulent duct passed all six route bars. No bar was moved. Measured

A mixed chain refused by identity

The throat example above is now a refusal: a mover that does not match the forward run is rejected before any number exists. The refused chain is kept as evidence. Measured

Below the noise floor, refused

A remeshed bracket with objective noise of 3.9e-5 was refused for finite differencing below its floor rather than reported as agreement. Measured

Labels that do not drift

A passing check reads “Direction-checked”; “Verified” is kept for a candidate confirmed by an independent re-run. A failed check stays on the label as “last check FAIL” with its run id. Method

6/6
route bars passed on the turbulent duct Measured
1.22 %
throat sensitivity from finite differences, chain restored Measured
0
bars moved after a measurement Method

What it changes for your programme

Optimisation budgets spent on designs that are really better

Engineering lead

A proposed shape change arrives with the check behind its gradient, so the review argues about physics, not derivatives.

Analyst

Step, directions, bars and Taylor fit done the same way on every route, with a verdict and a record, not a script rewritten per project.

Programme manager

Gradient runs go to routes that passed; a withheld route falls back or stops with both costs named before the budget burns.

Where it matters

Aerospace

Intakes and airfoils with hundreds of shape variables: an adjoint is affordable, a checked one is safe.

Turbomachinery and automotive

Bends and cooling passages tuned for pressure loss through mesh movement, the link most easily dropped.

Energy and process equipment

Exchanger and cold-plate passages, where a thermal adjoint is checked before it moves a wall.

Structures

Brackets and plates, with compliance shape derivatives checked the same way.

Typical workflowWith TensorLynx
WhenOnce, by hand, if time allowsBefore an optimiser may use the route
Step sizeA default valueSized from the measured noise of the objective
DirectionsOne perturbationTwo independent random directions
Unresolved checkRead as agreementUnknown, never Pass
FailureRescaled or ignoredRoute withheld, the failure kept on the label
ValidityAssumed to carry overTied to rank count, solver build and mesh

A gradient that passes here drives the design; the result is then confirmed by an independent high-fidelity reassessment, on meshes whose own error is measured in mesh verification. See how the chapters fit in the TensorLynx overview.

FAQ

Questions engineers ask first

Why check an adjoint gradient if the solver converged?

Convergence says the equations were solved, not that the derivative belongs to what the optimiser evaluates. A dropped mesh-movement term, an adjoint that stalled while the primal converged, or a changed parallel decomposition all leave a converged-looking run with a wrong gradient. The check is where that error becomes visible.

How is the finite-difference step chosen?

From the measured noise of the objective, not from a default. The platform estimates the noise floor, sizes the step to it, and refuses a parameter whose whole effect over the step is below that floor. A comparison the reference cannot resolve reads Unknown rather than Pass or Fail.

What is the two-direction rule?

Every check uses at least two independent random directions. If the ratio of projected gradient to finite difference is the same on both, it is a scale error and the direction still descends. If the ratios differ or flip sign, the error is as large as the gradient and no scaling repairs it.

What does Direction-checked mean, and how is it different from Verified?

Direction-checked means the gradient passed its check and may drive an optimiser. Verified is reserved for a candidate design that an independent re-run has confirmed against your acceptance limits. The two labels are kept apart in the interface and the report, and a failed check stays on the label with its run id.

Do you use complex-step derivatives?

Where the code path supports complex arithmetic. The platform's geometry Jacobians for free-form deformation match complex step to 4.5e-16. Flow-solver gradients are checked against noise-sized central finite differences and a Taylor remainder test, on a resolvable twin of the case where needed.

Can you run global sensitivity analysis, such as Sobol indices, on our design space?

Yes, as a study OLTRION engineers plan with you. Variance-based indices need thousands of evaluations, so they are computed on a surrogate, which must pass its fit verdict first. An index on a poor surrogate describes the surrogate, not your physics, and is labelled that way.

What do we receive from a gradient check?

A record of the route, the bars declared before measurement, the steps, cosine, regression slope, fitted Taylor order and verdict, with the inputs, rank count, solver build and mesh hash the gradient depends on. Change any of those and the check is due again.

One loop, not twelve tools

Where gradient verification sits in the TensorLynx loop

Every capability hands its result to the next on the same model, the same units and the same record: geometry feeds physics, physics feeds sensitivities and learning, optimisation proposes, verification confirms, and the history keeps every step reproducible.

The TensorLynx loop: Design exploration, Coupled multiphysics, Mesh verification, Adjoint optimisation, Gradient verification, Trust-aware surrogates, Full-field ROM, Multi-fidelity, MDAO, Pareto selection, High-fidelity reassessment, Provenance. TensorLynx one model · one record DefineSimulateImproveLearnOptimiseDecideVerifyRecord Design exploration Coupled multiphysics Mesh verification Adjoint optimisation Gradient verification Trust-aware surrogates Full-field ROM Multi-fidelity MDAO Pareto selection High-fidelity reassessment Provenance
Schematic of the platform workflowSchematic
Work with OLTRION

Bring us the design question. Leave with a verified answer and the record behind it.

TensorLynx is built and run by the engineers who use it on client work. You can start small, with one geometry and one question, and grow into a workflow your own team owns.

Feasibility review

Send a geometry, the objective and the constraints. We tell you which TensorLynx route answers it, what it needs from you, and what you will get back.

We run the study

Our engineers run the loop on your problem: physics, sensitivities, optimisation and full-model verification, handed over with every setting on record.

A workflow built for your product

A TensorLynx workflow, surrogate and verification gates set up around your product family, so the next design cycle starts where the last one ended.

Platform access and handover

Your team on TensorLynx, trained on your own cases, with OLTRION engineers behind it for the questions that need a specialist.