Skip to content

Add PDE-solver-related integration tests - #3004

Open
SpeedyTurtle599 wants to merge 5 commits into
EnzymeAD:mainfrom
SpeedyTurtle599:bcoveler/tests/frechet-integration-tests
Open

Add PDE-solver-related integration tests#3004
SpeedyTurtle599 wants to merge 5 commits into
EnzymeAD:mainfrom
SpeedyTurtle599:bcoveler/tests/frechet-integration-tests

Conversation

@SpeedyTurtle599

@SpeedyTurtle599 SpeedyTurtle599 commented Jul 26, 2026

Copy link
Copy Markdown
Contributor

Added integration tests inspired by common PDE solver workflows. Includes

  1. Euler-theorem homogeneity of the flux Jacobian: the compressible Euler flux is homogeneous of degree 1 in U for constant gamma, so by Euler's theorem, $A(U) \cdot U ≡ F(U)$ exactly, where $A = \partial F / \partial U$. That validates a full 5x5 AD Jacobian against the primal at machine precision with zero hand-differentiation and no $\epsilon$ value.

  2. Differentiating a Newton inversion with a data-dependent trip count: a SHO thermo table is a great AD specimen, since we can invert e_mix(T,Y) = e_target by Newton for up to 50 iterations, break on convergence, clamp it to physical hypersonic limits T $\in$ [50, 50000], then do one tangent-collapse polish step at the end. The polish step is what makes forward-mode AD through the loop exact ($\partial T/ \partial e = 1/c_{v}$ by the implicit function theorem) regardless of where the loop happened to stop. Without it you're differentiating the iterates, which converge to the right answer only as fast as the primal does

  3. Nonsmooth nonlinear weights (TENO5 / WENO5-Z): shows step functions and other horrible shock capturing oddities that need to pass through AD without degenerate FD garbage. TENO's sharp cutoff is $\delta_k = (\chi_k < C_T) ? 0 : 1$ at $C_T$ = 1e-5 (a strong step function). WENO5-Z has a fabs kink in the same style with its $\beta$ smoothness indicators.
    Away from the cutoff, AD and FD agree tightly; at the cutoff, AD gives the correct one-sided derivative and FD is awful because it straddles the branch. Encoding that as a test documents where FD and AD are expected to disagree, which is exactly the confusion that makes people distrust AD on shock-capturing schemes when it's really okay

  4. Guarded normalisation: normalis the velocity-difference vector $\Delta q / \abs{\Delta q}$ with an $\epsilon$ guard. d/dx sqrt(x) -> $\infty$ at 0 is the classic AD NaN factory, and the subtle version is that $\abs{\Delta q} > \epsilon$ ? f(Δq) : fallback can still produce NaN in the derivative because the untaken branch's tangent gets multiplied by zero — and 0 * NaN = NaN

  5. Entropy Hessian via forward-over-reverse: entropy-stable flux implies a mathematical entropy $\eta(U)$ whose gradient gives the entropy variables and whose Hessian $\partial^2 \eta / \partial U^2$ must be symmetric and positive definite. Nested AD is where I've had trouble with Enzyme in the past, so this demonstrates Cholesky-like suitability.

@SpeedyTurtle599 SpeedyTurtle599 changed the title Add miscellaneous hypersonic-CFD-inspired integration tests Add PDE-solver-related integration tests Aug 7, 2026
@SpeedyTurtle599
SpeedyTurtle599 marked this pull request as ready for review August 7, 2026 16:02
@SpeedyTurtle599
SpeedyTurtle599 force-pushed the bcoveler/tests/frechet-integration-tests branch from d0fa056 to 35c95c1 Compare August 7, 2026 16:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant