{"id": "adjoint_gradients", "title": "Adjoint gradients versus finite differences", "description": "Total derivatives of force coefficients with respect to angle of attack, Mach number, Reynolds number and a smooth surface-shape perturbation are computed with one transposed (adjoint) solve per output and compared with central finite differences of fully re-converged flows. For the scalar inputs of the Euler case the derivatives are also computed in direct (forward) mode, an independent linear solve of the same linearization, and compared with the adjoint values.", "passed": true, "checks": [{"name": "Euler: dcl/dalpha adjoint vs FD (rel.)", "value": 9.817993491634284e-11, "expected": "< 1e-6", "passed": true}, {"name": "Euler: dcl/dalpha direct vs adjoint mode (rel.)", "value": 2.733550199859101e-09, "expected": "< 1e-4 (limited by the linear-solve tolerance 1e-10)", "passed": true}, {"name": "Euler: dcd/dalpha adjoint vs FD (rel.)", "value": 2.0355872886702974e-08, "expected": "< 1e-6", "passed": true}, {"name": "Euler: dcd/dalpha direct vs adjoint mode (rel.)", "value": 2.8444100664213378e-08, "expected": "< 1e-4 (limited by the linear-solve tolerance 1e-10)", "passed": true}, {"name": "Euler: dcm/dalpha adjoint vs FD (rel.)", "value": 1.1288027820666513e-08, "expected": "< 1e-6", "passed": true}, {"name": "Euler: dcm/dalpha direct vs adjoint mode (rel.)", "value": 4.611528346583822e-07, "expected": "< 1e-4 (limited by the linear-solve tolerance 1e-10)", "passed": true}, {"name": "Euler: dcl/dmach adjoint vs FD (rel.)", "value": 1.9822479503217117e-09, "expected": "< 1e-6", "passed": true}, {"name": "Euler: dcl/dmach direct vs adjoint mode (rel.)", "value": 2.6393262534204177e-06, "expected": "< 1e-4 (limited by the linear-solve tolerance 1e-10)", "passed": true}, {"name": "Euler: dcd/dmach adjoint vs FD (rel.)", "value": 2.1348881030379058e-08, "expected": "< 1e-6", "passed": true}, {"name": "Euler: dcd/dmach direct vs adjoint mode (rel.)", "value": 1.1047187121177576e-05, "expected": "< 1e-4 (limited by the linear-solve tolerance 1e-10)", "passed": true}, {"name": "Euler: dcm/dmach adjoint vs FD (rel.)", "value": 7.828459756963148e-09, "expected": "< 1e-6", "passed": true}, {"name": "Euler: dcm/dmach direct vs adjoint mode (rel.)", "value": 6.906073435183136e-05, "expected": "< 1e-4 (limited by the linear-solve tolerance 1e-10)", "passed": true}, {"name": "Euler: dcl/dshape (directional) adjoint vs FD (rel.)", "value": 6.728235935140326e-09, "expected": "< 1e-6", "passed": true}, {"name": "Euler: dcd/dshape (directional) adjoint vs FD (rel.)", "value": 1.647957588458894e-08, "expected": "< 1e-6", "passed": true}, {"name": "Euler: dcm/dshape (directional) adjoint vs FD (rel.)", "value": 3.841303915587329e-08, "expected": "< 1e-6", "passed": true}, {"name": "Navier\u2013Stokes: dcd/dre adjoint vs FD (rel.)", "value": 4.760700298204578e-10, "expected": "< 1e-6", "passed": true}, {"name": "Navier\u2013Stokes: dcd/dmach adjoint vs FD (rel.)", "value": 1.3253795752073941e-09, "expected": "< 1e-6", "passed": true}, {"name": "step sweep: best FD agreement with adjoint (rel.)", "value": 1.1864146880313888e-10, "expected": "< 1e-8", "passed": true}], "charts": [{"id": "fd_step_sweep", "type": "line", "title": "Finite-difference error of dcl/d\u03b1 versus step size", "xlabel": "step size", "ylabel": "|FD \u2212 adjoint| / |adjoint|", "xscale": "log", "yscale": "log", "series": [{"name": "central difference", "x": [0.01, 0.001, 0.0001, 1e-05, 1e-06, 1e-07, 1e-08, 1e-09], "y": [0.00010051996125346824, 9.767944373780888e-07, 9.695845150734631e-09, 1.1864146880313888e-10, 1.8974296056524398e-10, 2.372429499229292e-10, 2.758910224946449e-09, 3.9518189910920783e-07]}], "reference_slopes": [{"slope": 2, "label": "\u03b5\u00b2 truncation"}], "note": "Smallest difference in this run: 1.2e-10 at a step of 1e-05. The reference line is the \u03b5\u00b2 truncation error of a central difference; round-off of the re-converged flows grows as 1/\u03b5."}], "tables": [{"id": "gradients", "title": "Adjoint, finite-difference and direct derivatives", "columns": ["case", "derivative", "adjoint", "finite difference", "rel. diff. (adjoint, FD)", "rel. diff. (adjoint, direct)"], "rows": [["Euler NACA 0012", "dcl/dalpha", 7.596264502000285, 7.596264502746085, 9.817993491634284e-11, 2.733550199859101e-09], ["Euler NACA 0012", "dcd/dalpha", 0.022235517293480216, 0.02223551774610359, 2.0355872886702974e-08, 2.8444100664213378e-08], ["Euler NACA 0012", "dcm/dalpha", 0.012370178257583518, 0.012370178117948603, 1.1288027820666513e-08, 4.611528346583822e-07], ["Euler NACA 0012", "dcl/dmach", 0.2182621467314891, 0.2182621471641388, 1.9822479503217117e-09, 2.6393262534204177e-06], ["Euler NACA 0012", "dcd/dmach", 0.0003873448448567454, 0.00038734483658736657, 2.1348881030379058e-08, 1.1047187121177576e-05], ["Euler NACA 0012", "dcm/dmach", 0.0012851863500505157, 0.0012851863601115454, 7.828459756963148e-09, 6.906073435183136e-05], ["Euler NACA 0012", "dcl/dshape (directional)", 0.013049050114433787, 0.0130490500266367, 6.728235935140326e-09, null], ["Euler NACA 0012", "dcd/dshape (directional)", -2.450111528982182e-05, -2.4501115693589814e-05, 1.647957588458894e-08, null], ["Euler NACA 0012", "dcm/dshape (directional)", 0.00039401070332647457, 0.0003940107184616237, 3.841303915587329e-08, null], ["Cylinder Re = 40", "dcd/dre", -0.0125001308289184, -0.012500130834869339, 4.760700298204578e-10, null], ["Cylinder Re = 40", "dcd/dmach", 0.27041107242588636, 0.27041107206748904, 1.3253795752073941e-09, null]]}], "provenance": {"version": "0.4.0", "commit": "39979fcf902ad6116eb550b881b4278d4599c8e2", "dirty": false, "describe": "39979fcf90", "device": {"platform": "cpu", "device": "cpu:0", "device_kind": "cpu", "jax": "0.11.2", "x64": true}, "timestamp": "2026-11-12T11:18:25-0500"}, "wall_time": 1176.07, "notes": "Largest relative difference in this run: adjoint against finite differences 3.8e-08, adjoint against direct mode 6.9e-05.", "level": "quick"}