|
FhSim
3.1.0
Marine systems simulation
|
| ID | 0051 |
| Class | TEST |
| Severity | 1 |
| Status | ready |
Models: —
Found: 2026-10-20 architecture review (a406e955); owner ruled "default ok" on the whole plan 2026-10-20
Source plan: plans/arch-2026-10-20/not-implemented/f9-sundials-solver-plan.md (workspace fhsim_workspace)
Kind: Bit for bit refactor. Take when passing; rides with: next feature in src/engine/integrator/.
src/engine/integrator/sundials/FhIntegratorSundials.cpp:352-402, FhIntegratorSundials::JacobianCallback. The block :368-399 copies the dense buffer localJ into a dense (:369), sparse (:375) or band (SUNMATRIX_BAND) SUNMatrix inline inside the callback, so each copy can only be reached by running CVODE/ARKODE.
The sparse branch may be unreachable: a sparse matrix is only accepted with SPGMR (SolverPlan.cpp:153-163 refuses it for DENSE and BAND), and CVODE/ARKODE may not call JacFn for a matrix-free SPGMR. Check that first.
None for users. The three copies have no direct unit test.
Free function CopyIntoSunMatrix(localJ, n, J, sparsity) in the same file's anonymous namespace or a small header, with one unit test per matrix type. Worth doing only when someone touches this code for another reason; if the sparse branch is unreachable, say so there instead of testing it.
Unit tests that build a SUNMatrix of each type, call CopyIntoSunMatrix and compare entries.
Very low; the loops move unchanged. Keep the rule that the SUNDIALS callbacks do not call OdeFcn (settled-decisions.md).