Skip to content

fix(capi): sample a deck current at the line nodes on the point route - #137

Merged
SMI-Lab-Inha merged 3 commits into
devfrom
fix/capi-point-current
Nov 8, 2026
Merged

SMI-Lab-Inha merged 3 commits into
devfrom
fix/capi-point-current

Conversation

@SMI-Lab-Inha

Copy link
Copy Markdown
Owner

On the EI = 0 point route (CD_Init_Deck_System, used by the C API and Python), each line took its drag fluid velocity at the nodes of its straight seed, and nothing sampled the current again. In a current that varies in space (a depth profile, a Currents 1 table or a steady grid), the start therefore differed from the driver's static state, by up to 1.7 % of an end-load component on the test deck and up to 14 % in the fuzz campaign. A held chain also drifted by 0.4 % of its fairlead tension in 2 s.

  • At initialisation the current is now sampled at the static nodes (the t = 0 state), as the standalone march does before its first step.
  • The deck current is returned to the C API handle, which samples it at the step-start nodes before every CableDyn_Step on the point route, as the driver does.
  • A model built from raw lines or on the aggregate route has no deck current of its own, so the handle drops it.

Check. The start now matches the driver within 2e-7, and a held line stays at rest to 1e-6 (1e-10 measured).

Test. python/tests/test_point_current_profile.py. CTest passes on both BLAS kernels; pytest passes. Examples are identical.

A deck of EI = 0 lines initialised through the C API (CableDyn_InitDeck, and
Python's CableDyn) runs on the point route (CD_Init_Deck_System). Each line
model took its drag's fluid velocity at the nodes of its straight seed between
its ends, while the static solve samples a depth profile or grid at its own
node positions, and nothing sampled the current again: the standalone driver
samples it at every node before every step. In a current that varies in space
(a profile current, a Currents 1 table, a steady grid) the start was not the
static state (end loads off the driver's by up to 1.7 % of a component), and a
line held at rest drifted (a chain catenary in a 1.3 to 0.23 m/s profile: 0.4 %
of its fairlead tension and 12 % of a force component in 2 s). A uniform
current is the same at every node and was not affected.

CD_Init_Deck_System now samples the current at the static nodes (the t = 0
state, re-deriving the line accelerations where the field changed) and returns
the deck current for the caller to sample again; the C API samples it at the
step-start nodes before every CableDyn_Step on the point route, as the driver
does. A model built from raw lines or on the aggregate drops it.

With the fix the start equals the driver's static state and a held line stays
at rest to 1e-10; a 150-deck campaign of C API stepping against the driver no
longer shows the profile-current mismatches (up to 14 % before). The new
python/tests/test_point_current_profile.py holds the chain at rest for 100
steps and compares its start with the driver's.

Signed-off-by: Jae Hoon Seo <jaehoon.seo@inha.ac.kr>
The [Unreleased] entries of the open changes are added together in one
change, so that they do not conflict with each other.

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 Nov 8, 2026 •

Copy link
Copy Markdown
Codex Review Summary: ✅ Completed

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

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-08T19:14:27.068451Z 4c479f4 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

read-the-docs-community Bot commented Nov 8, 2026 •

Copy link
Copy Markdown

Documentation build overview

📚 CableDyn | 🛠️ Build #35738067 | 📁 Comparing 4c479f4 against latest (e8f88f5)

  🔍 Preview build  

11 files changed · ± 11 modified

± Modified

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 304aaa5fc5

ℹ️ 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".

Comment thread src/CableDyn_CAPI.f90 Resolved
On the point route, CableDyn_Step samples the deck current at the
step-start nodes before CD_FAST_Step validates dt and the motion. A step
refused there (dt <= 0, non-finite motion) or a hard solver failure left
the new fluid field in place, so CableDyn_CalcOutput afterwards returned
different loads from those before the failed call.

The step now keeps every line's drag fluid velocity and waterline before
sampling and puts them back when the step does not commit.
test_point_current_profile gains test_a_refused_step_leaves_the_loads: after
a 2 m surge, a step with dt = -1 and one with a NaN motion leave
calc_output and the channels bit-identical (it failed before). CTest
369/369 on both BLAS kernels.

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

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. 🚀

Reviewed commit: 4c479f477c

ℹ️ 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 eba09ad into dev Nov 8, 2026
16 checks passed
@SMI-Lab-Inha
SMI-Lab-Inha deleted the fix/capi-point-current branch November 9, 2026 08:55
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