FhSim  3.1.0
Marine systems simulation
Loading...
Searching...
No Matches
0175 — The self-connection check misses other users of the model Jacobian
ID 0175
Class TEST
Severity 1
Status ready

Models: —

Found: 2026-10-26, r2-newton-solvers (Q4a) verification, 4dcb3a9d

Evidence

The check is RefuseSelfConnection in SolverPlan.cpp:155, called at :359 (SUNDIALS) and :410 (BackwardEuler_i). Other users of the model Jacobian do not call it:

  • src/visual/ui/JacobianViewerPanel.cpp:107 (EvaluateModelJacobian).
  • src/testtools/JacobianChecker.cpp:291,350 (HasAnalyticalBlock and the system check's EvaluateModelJacobian).
  • src/engine/model/SensitivityAnalyzer.cpp:421,663 (the port Jacobians InputPortJacobian and OutputPortJacobian).
  • src/engine/integrator/preconditioners/JacobiDiagonalPreconditioner.cpp:74 (EvaluateModelJacobian; not checked whether it runs when the Jacobian callback is not wired). See plan plans/r2-newton-solvers.md section 13.
  • src/engine/model/SensitivityAnalyzer.cpp: the four sweeps that used the model's analytical Jacobian (m_odeJacobianFn; found by the 2026-11-04 review, finding R9) were not on this list. They gave wrong numbers for a self-connected model run with an explicit method. Fixed by FHSIM-0232: EvaluateOdeJacobian uses a finite-difference Jacobian of the whole model when the model has a self-connection (test SensitivitySelfConnection.*).

No test covers the SUNDIALS refusal at SolverPlan.cpp:359.

Effect

These users may read a Jacobian of a model with a self-connection that the implicit solvers refuse.

Possible fix

Owner decides whether each should refuse too (the Jacobi preconditioner first). Add a test for the SUNDIALS refusal.

Test that would prove it

A SUNDIALS run of a self-connected model with the Jacobian callback wired throws on setup.

Risk

Low. Owner ruling: file only, no code now.

Progress (2026-10-27)

Owner ruling 2026-10-27: add only the missing SUNDIALS test; the other Jacobian users stay as they are. The test is done in 3cd39aaa (ModelStructure_PortValidation.SelfConnection_SundialsJacobianCallback_ThrowsOnSetup). The other users (the list under Evidence) stay open: this issue is not resolved.

Progress (2026-11-04)

Review of d5ce8047: the line numbers above are refreshed to that date. The sensitivity sweeps that read the model's Jacobian (m_odeJacobianFn) are fixed (FHSIM-0232). The remaining users (viewer, checker, Jacobi preconditioner, the port Jacobians of the sweeps) stay as the 2026-10-27 ruling left them. Not yet decided by the owner: whether the port-Jacobian users of the sweeps (:421,663) need the same fallback; the sweep test passes with them unchanged.