|
FhSim
3.1.0
Marine systems simulation
|
| ID | 0055 |
| Class | BUG |
| Severity | 1 |
| Status | blocked |
Models: —
Found: 2026-10-20 F3 review of the fill paths (a406e955), re-located at df9569e8
Source plan: plans/arch-2026-10-20/f3-jacobian-assembler-split.md, finding 2 (workspace fhsim_workspace)
Decision needed: owner to rule (F3-Q2: file and leave). Unifying the paths moves results, so it is not part of the F3 refactor.
SensitivityAnalyzer::GetAdjointSensitivity (src/engine/model/SensitivityAnalyzer.cpp:1065) tests if (nStates == 0) { return; } at :1072-1074 and zeroes adjointInput afterwards (:1076-1078). GetForwardSensitivity (:801) zeroes resultVector first (:813-815) and returns at :818.
For a model with no states the forward sweep returns zeros and the adjoint sweep returns the values the caller's buffer already held. A caller that does not clear its buffer reads stale numbers, and the two sweeps are not transposes of each other in that case. The test pins it with a sentinel of -777.
Owner to rule (F3-Q2: file and leave). Move the zeroing loop above the early return, as in the forward sweep. The result for a stateless model is then zero, which is what the direct feedthrough terms already assume.
SensitivityAnalyzer.MixedScalarVectorFeedthrough_EverySweep_MatchesRecordedValues in tests/model/SensitivityAnalyzer_test.cpp (green): the model has no states and outputSensitivityAdjoint and adjointSensitivity stay at the recorded -777 sentinel. A fix changes those two recorded values to 0.
Low. Changes an output that is undefined today. Check the DLL and FMU callers (DirectionalDerivative_test) pass a cleared buffer.