Add PDE-solver-related integration tests - #3004
Open
SpeedyTurtle599 wants to merge 5 commits into
Open
Conversation
SpeedyTurtle599
marked this pull request as ready for review
August 7, 2026 16:02
…owcasing differentiation techniques through intentionally-non-smooth stencils
…n rotated-geometry pitfall in CFD Riemann kernels
…metric-positive-definite behaviour on nested AD cases
SpeedyTurtle599
force-pushed
the
bcoveler/tests/frechet-integration-tests
branch
from
August 7, 2026 16:02
d0fa056 to
35c95c1
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Added integration tests inspired by common PDE solver workflows. Includes
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.
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
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
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
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.