|
FhSim
3.1.0
Marine systems simulation
|
| ID | 0036 |
| Class | BUG |
| Severity | 2 |
| Status | ready |
Models: —
Found: 2026-10-02, R135 implicit-integrator review of the net-hydrodynamics programme (cage24 case), at e782fc44. Related: FHSIM-0028, MARE-0122.
The model is a 24 × 6 cylinder cage Net/NetStructure (1008 states, CastWake="1") with <Integrator Method="BDF"> and no <LinearSolver>. The run aborts before the first step. The same failure occurred with the binaries built before and after the R135 hold change (B2 and B3), so it is not a consequence of the wake work.
Log, at e782fc44 (SUNDIALS 7.5):
CVodeGetIntegratorStats at the failure: steps 0, NLS step fails 1, RHS evals 4, initial step 1.5e-8 s. Flag −6 is CV_LSETUP_FAIL, so the SPGMR preconditioner setup callback returned an unrecoverable error on its first call. The error is not reported by FhSim: the log names no cause.
Code path:
src/engine/model/JacobianSparsityAnalyzer.cpp:487-503: SelectLinearSolver returns NearTridiagonal when the density is below 0.5, exactly one SimObject has states (numStateful == 1) and NearTridiagonalSolver::DetectStructure reports detected. Here it reports bandwidth=0, extra_blocks=0, correction_rank=0 for a pattern with 15.8 % density (160 776 non-zeros in 1008 × 1008). That is not the structure the solver is meant for.src/engine/integrator/sundials/SundialsSolverBuilder.cpp:107-125: for SPGMR, the resolved type NearTridiagonal is used as a preconditioner through CreateLinearSolver, and the log line Preconditioner "NearTridiagonal" set up is written once IsReady() is true. Whether the numeric factorisation at the first gamma succeeds is only known inside the setup callback.The cause inside NearTridiagonalSolver (detection or factorisation) is not diagnosed here.
At e782fc44, with marine_elements and environment libraries built from the net-hydrodynamics branches (the failure is in the FhSim core, not the wake). The script below writes cage_net.xml and cage_in.xml. It is gen_cage.py --ncirc 24 --nrows 6 --castwake 1 --method BDF --tend 10 --step 0.1 reduced to what the case needs.
gen.py:
Results, one thread, StepMax="0.1", AbsTol=RelTol=1e-3, 10 s:
| Configuration | Result |
|---|---|
default (no <LinearSolver>: SPGMR + auto NearTridiagonal preconditioner) | fails at t = 0, flag −6 |
<LinearSolver Type="DENSE"/> | runs to 10 s (4227 steps) |
<LinearSolver Type="SPGMR" Preconditioner="none"/> | runs to 10 s (4279 steps) |
<LinearSolver Type="SPGMR" Preconditioner="jacobi"/> | runs to 10 s |
| DIRK (ARKode), DENSE | runs to 10 s |
Step counts are from the review run with ExternalWakeUpdate at its default. Run times under B3: DENSE 7.0 s, SPGMR none 2.3 s.
A user who writes <Integrator Method="BDF"> for a net with about 1000 states and no <LinearSolver> gets no run at all. Both cheaper and slower workarounds exist, but nothing in the log points to them. The structural auto-selection also makes the result worse than the unpreconditioned default of FHSIM-0028 and MARE-0122, which at least runs. FHSIM-0028 option (a) (DENSE by default for DenseLU models) would not reach this case, because here the resolved solver is not DenseLU.
DetectStructure accepts this 15.8 %-dense pattern with no bandwidth and no extra blocks, and why the setup fails. Either tighten the detection or fix the factorisation.SetupSpgmrPreconditioner already does when prec->IsReady() is false), and log which preconditioner failed and why, instead of aborting with a bare CV_LSETUP_FAIL.A Sundials test on a model whose sparsity pattern is dense enough to reach the NearTridiagonal branch with bandwidth=0, extra_blocks=0 (the pattern from the reproduction above, or a reduced one with the same signature, found while diagnosing), Method="BDF", no <LinearSolver>. Assert that the run completes, and that if a preconditioner is rejected, the log names it. It fails today with flag −6 at t = 0.
Changing the detection can change the auto-selected solver, and therefore the step sequence, of existing models that run with NearTridiagonal today. (b) alone only affects the runs that fail today.