Reliable Gradients for Implicit-Adjoint Optimization in Differentiable CFD
Abstract
Machine learning increasingly couples imperfect scientific simulators to parameter fitting, control, and design. Physical model discrepancy is not the only threat to these workflows: a numerical solver can return a gradient of a different map from the steady model that scientists intend to interrogate. We study this backward misspecification in an unstructured compressible air--hydrogen CFD simulator. Exact differentiation of a finite pseudo-time trace validates the derivative of the executable algorithm, but does not certify the intended steady sensitivity: even after strong primal convergence, the gradient can remain nearly opposite to the residual-root gradient and can change substantially with initialization and update schedule. Such trace gradients can turn a step intended as descent into ascent after strict reevaluation. We develop a matrix-free implicit adjoint using JAX Jacobian products and device-resident GMRES, together with an audit that independently checks primal convergence, adjoint consistency, target-specific finite differences, and solver-path invariance. Strictly reconverged root gradients become path-invariant, whereas deliberately truncated adjoints reveal that a nominally successful linear solve can still misdirect optimization. The audit does not remove physical model error; it prevents numerical backward semantics from masquerading as scientific sensitivity.