FhSim  3.1.0
Marine systems simulation
Loading...
Searching...
No Matches
0083 — Cable.cpp addWaveInertia duplicates environment cylinder_hydro::MorisonInertiaForce
ID 0083
Class ARCHITECTURE
Severity 1
Status ready

Models: —

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

Source plan: plans/arch-2026-10-20/not-implemented/f1-cable-segment-module.md (workspace fhsim_workspace)

Kind: Bit for bit refactor. Take when passing; rides with: the next base feature (E6 phase 2-3 or E12 cleanup).

Evidence

src/cable/Cable.cpp:430-438, a file-local helper (doc comment :424-429):

static void addWaveInertia(double scale, const double acc[3], const double Q[3], double* FA, double* FB)
{
const double along = dot(acc, Q);
for (int j = 0; j < 3; j++) {
const double normal = acc[j] - along * Q[j];
FA[j] += scale * normal;
FB[j] += scale * normal;

Callers: Cable.cpp:617 and :726. The same formula lives in fhsim_environment include/fhsim_environment/hydrodynamics/CylinderHydro.h:335, cylinder_hydro::MorisonInertiaForce(factor, acceleration, axis, force) (ENV-0101, ADR 0002), and base already requires fhsim_environment (conanfile.py:41).

Effect

None for users. Two copies of one law (R67) can drift.

Possible fix

Call cylinder_hydro::MorisonInertiaForce from addWaveInertia (or from the two callers) and keep the add-to-both-nodes loop. Compare result bytes for every SimObj-Cable_* case.

Test that would prove it

Existing SimObj-Cable_* regressions and tests/src/WaveExcitation_Test.cpp:80, byte compared before and after.

Risk

Low. The floating point order must stay the same (acc - along*Q, then scale); verify by byte compare, not tolerance.