Skip to content

perf(hermite): assemble a cable reaction from its node's elements - #37

Merged
SMI-Lab-Inha merged 1 commit into
devfrom
perf/cable-node-reaction
Oct 21, 2026
Merged

SMI-Lab-Inha merged 1 commit into
devfrom
perf/cable-node-reaction

Conversation

@SMI-Lab-Inha

Copy link
Copy Markdown
Owner

Summary

Second optimisation from the profiles of #34 and #35, after #36. The reaction of a finite-EI cable at a node is the fairlead load the OpenFAST module returns on every CalcOutput. To read three rows, it assembled:

  • the residual of the whole line;
  • the added mass of the whole line;
  • the whole mass times the acceleration.

What changes:

  • assemble_residual takes an optional node_only with a caller residual R_out. It assembles only:

    • the elements that reach the node;
    • the node's own terms: attachments, contact and end connection.

    Each term is added in the order of the full assembly, so the node's rows are bit-identical. The model's scratch (residual and mass) is not touched.

  • Contact and attachments take node bounds. Contact writes through the residual it is given instead of the model's.

  • Added mass: the per-element matrix moves into added_mass_element, shared by assemble_added_mass and the reaction.

  • The reaction builds the node's rows of the added mass from the same one or two element matrices. It forms the inertia column by column, in the same order as band_matvec.

  • Full assembly is kept for a line with torsion, which couples every element, and when full_assembly = .TRUE. is passed.

Why the shared scratch is safe to leave alone. Every other reader rebuilds it first:

  • the step rebuilds the total mass at its start;
  • the force cache copies the residual right after assemble_committed_force.

Measurement

IEA-15 VolturnUS-S, DLC-1.6 environment, 600 s at dtM = DT = 0.025 s, OMP_NUM_THREADS=1, CABLEDYN_PROFILE=1, chain + 248-element power cable.

before (#36) this PR
Wall time 212 s 194 s
CalcOutput / loads 25.0 / 19.9 s 8.6 / 3.6 s
OpenFAST Time Ratio 3.07 3.37
OpenFAST .out and CableDyn .CD.out (chain-only and mixed) byte-identical

Tests

  • New hermite_node_reaction. Compares the node reaction with the full-assembly reaction at every node, bit for bit, at 2835 node evaluations. It also checks that the residual and mass scratch are untouched.
    • Hand-built cables: a seabed run and a riser with:

      • contact with friction on a controlled seabed, axial damping, drag in a current, added mass;
      • Airy waves, or a held field with attachments next to each end;
      • finite, rigid or no end connections;

      at the rest state and at scattered positions (some below the bed), velocities and accelerations.

    • The IEA-15 MW mixed mooring example: along 4 s of coupled surge and heave in a current, and after a fairlead transfer without a step (the CalcOutput state).

    • Mutation check: reversing the column order of the inertia sum makes it fail, at 1644 nodes.

  • All 51 shipped examples write byte-identical outputs against perf(openfast): skip the discarded cable reactions in CalcOutput #36 (run time 163 s against 164 s).
  • Full suite (Windows, gfortran, Release, slow tier included): 294/294. Python: 2038 passed. pre-commit run --all-files and the Sphinx build with -W pass. OpenFAST builds.

Checklist

  • pre-commit run --all-files passes
  • ctest --test-dir build --output-on-failure passes
  • python -m pytest tests python/tests passes (if Python or validation records changed)
  • VALIDATION.md updated if a validation result changed (none changed)
  • CHANGELOG.md updated under [Unreleased] (heading added if missing) for user-visible changes
  • Documentation in doc/ updated for changed inputs, options, or outputs (no input, option or output changed)
  • Conventional Commit title (feat:, fix:, docs:, ...)
  • Commits are signed off (git commit -s) under the
    Developer Certificate of Origin

The reaction of a finite-EI cable at a node (the fairlead load the
OpenFAST module returns on every CalcOutput) assembled the residual and
the added mass of the whole line and multiplied the whole mass by the
acceleration, to read three rows. With a 248-element power cable this
was 20 s of a 212 s coupled run.

assemble_residual takes an optional node_only with a caller residual
R_out: it assembles only the elements that reach the node and the
node's own terms (attachments, contact, end connection), each in the
order of the full assembly, so the node's rows are bit-identical and the
model's scratch is not touched. The contact and attachment assemblies
take node bounds, and contact writes through the residual it is given.
The reaction builds the node's rows of the added mass from the same one
or two element matrices and forms the inertia column by column as
band_matvec does. A line with torsion, which couples every element,
keeps the full assembly, as does full_assembly = .TRUE.

test_hermite_node_reaction compares the two at every node, bit for
bit, on hand-built cables with every load section (contact with
friction on a controlled seabed, attachments, axial damping, drag,
added mass, Airy waves or a held field, finite, rigid or no end
connections) at scattered states, and along a coupled trajectory of the
IEA-15 MW mixed mooring example, also after a fairlead transfer; it
fails when the inertia sum is reordered. All 51 examples write
byte-identical outputs, and the coupled chain-only and mixed OpenFAST
runs write byte-identical outputs, the mixed one in 194 s instead of
212 s.

Signed-off-by: Jae Hoon Seo <jaehoon.seo@inha.ac.kr>
@SMI-Lab-Inha

Copy link
Copy Markdown
Owner Author

@codex review

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 21, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-21T06:17:25.373886Z 90f056e Manual request
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@read-the-docs-community

Copy link
Copy Markdown

Documentation build overview

📚 CableDyn | 🛠️ Build #35288729 | 📁 Comparing 90f056e against latest (d3ddfeb)

  🔍 Preview build  

3 files changed
± changelog.html
± cli.html
± faq.html

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. More of your lovely PRs please.

Reviewed commit: 90f056e59f

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@SMI-Lab-Inha
SMI-Lab-Inha merged commit da5dfad into dev Oct 21, 2026
15 checks passed
@SMI-Lab-Inha
SMI-Lab-Inha deleted the perf/cable-node-reaction branch October 21, 2026 07:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant