FhSim  3.1.0
Marine systems simulation
Loading...
Searching...
No Matches
0402 — NetStructure: move cable drag Jacobians next to the drag law, inline ComputePanelJacobianAD, add a scatter helper
ID 0402
Class ARCHITECTURE
Severity 1
Status ready

Models: —

Found: 2026-10-20 architecture review (6ebdae3); owner ruled "default ok" on the whole plan 2026-10-20

Source plan: plans/arch-2026-10-20/not-implemented/f8-net-element-jacobians.md (workspace fhsim_workspace)

Kind: Bit for bit refactor. Take when passing; rides with: the next feature editing src/net/NetStructure.*.

Evidence

src/net/NetStructure.cpp:

  • ComputeCableDragVelocityJacobian (:603) and ComputeCableDragPositionJacobian (:669), through :737, hold the analytic derivative of the cable drag. The drag law itself is elsewhere, so a change to the law needs a change here.
  • ComputePanelJacobianAD (:739-783; declared NetStructure.h:452) is only an unpacker: it calls NetElement3N::NodeForceJacobian and copies dF[3][6][9] into 18 named 3x3 arrays; its one caller is :916.
  • The cable and panel scatter loops in FillAnalyticalJacobian (from :785) repeat "add 3x3 block times 1/m at (row node, column state)".

Effect

None for users. The derivative is far from the law it differentiates, and the 18-array unpacker adds a layer that hides nothing.

Possible fix

(1) Move the two cable drag Jacobian functions next to the drag law. (2) Delete ComputePanelJacobianAD and its declaration; call NodeForceJacobian in FillAnalyticalJacobian and scatter dF[node][group] directly. (3) One local helper for the 3x3 scatter loops.

Test that would prove it

Net Jacobian tests and every net regression; byte compare of the Jacobian and of the results before and after.

Risk

Low. Bit for bit; the order of the additions must not change. Do not change JACOBIAN_RECIPE.md content except names.