KernelBackend: the aero_panel kernel's analytical Jacobian is NaN under ContinuousAero - #299
KernelBackend: the aero_panel kernel's analytical Jacobian is NaN under ContinuousAero#2991-Bort-1 wants to merge 4 commits into
Conversation
The KernelBackend plans a Jacobian and gives it to FBDF unseen. #289 reports it coming back NaN for the aero_panel kernel under ContinuousAero on some hardware, and the only thing the user sees is dt driven below floating-point epsilon on the first implicit step, which names neither the Jacobian nor the kernel. build_jacobian now evaluates its plan once at the model's initial state. A non-finite result warns, names the kernels whose own dual pass came back non-finite, and returns nothing, so the solver differentiates the right-hand side itself. That is the policy the self-feeding case already had, and the same outcome as the analytic_jacobian=false workaround, reached without the user having to find it. test_analytic_jacobian.jl gains the ContinuousAero wing the report is about, so the aero_panel kernel's dual pass is covered and the guard is shown not to fire on a healthy model. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Y87tAaun3BWKHndQYmPoxx
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
|
It should error instead of warn |
…nd-the-aero-panel-kernel-s-an # Conflicts: # CHANGELOG.md
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01KxezjtdNiiUyeFn5TQgXPR
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01RswCH5gqK6k7GKt22SSya6
|
Local full suite: PASS (37 min, Julia 1.12.7, one cell of the matrix) |
|
But this doesn't close the issue. You haven't found the cause of the issue. Can it be reproduced on a docker image? |
|
Agreed, and I have changed #299's trailer from Not on this box: there is no container runtime here — no docker, podman, apptainer, bwrap or chroot — and sudo wants a password. It would not add anything here in any case. A container swaps userspace, not the CPU, and the version axis it would pin is already pinned: this branch runs Julia 1.12.7, VortexStepMethod 4.3.1 and SymbolicIndexingInterface 0.3.55, the exact versions in the report, and an earlier round ran the whole of v0.15.1's On the machine that does reproduce it a container is exactly the right experiment, because there it holds the silicon fixed and swaps everything else. Still NaN inside → the CPU or the RAM. Clean inside → that install, and Worth running, because the contradiction in the report holds up against the generated body and against everything it calls. |
Fixed
The guard warned where you asked it to error, and once it errored it fired on
models whose Jacobian is fine: it was evaluated before the parameters were
synchronised, so it read the buffer
assembleleaves rather than the masses andinertias the system structure writes.
Changes
src/kernel_backend/jacobian.jl:258—check_jacobian_finiteevaluates theplan once and throws, naming the kernels whose own dual pass came back
non-finite and pointing at
analytic_jacobian=false.build_jacobianisuntouched planning again, so this file's diff to
mainis purely the addedfunction. The self-feeding path keeps its warn-and-decline: a model shape, not
a broken derivative.
src/kernel_backend/backend.jl:44— the check runs aftersync_params!, onproblem.u0/problem.p. Before this it ran ten linesearlier and reported
rigid_body/ride_wrenchas non-finite on a healthymodel.
test/test_analytic_jacobian.jl:232— asserts the throw; theContinuousAeroKernelBackendcase above it is the MWE this issue asked for.origin/main(fc9b9494); onlyCHANGELOG.mdconflicted, both sides'entries kept.
Verification
test/test_flap_aero.jlon theKernelBackend:6 passed, 2 erroredbefore the ordering fix, 18 passed after ·
test_analytic_jacobian.jl14 passed, and its throw testset is red when the guard only warns
(
13 passed, 1 failed, "No exception thrown").10 broken (17m44s) — the 10 broken are the pre-existing
Flow curvatureones ·
agent ci-local(monolith) PASS in 31m · GitHub CI all 7checks green on this head, the
1.12 ubuntu kernelcell included — thatis the cell whose failure found the ordering bug above.
init!now throws where it silently handed the solver a brokenJacobian, so a genuinely non-finite plan fails at build time instead of at the
first implicit step.
analytic_jacobian=falseis the way past it.Closes #289 · task
SymbolicAWEModels.jl-289