Skip to content

fix: friction-model routing of the batch and of 'auto' - #14

Merged
SMI-Lab-Inha merged 3 commits into
devfrom
fix/friction-model-routing
Nov 17, 2026
Merged

SMI-Lab-Inha merged 3 commits into
devfrom
fix/friction-model-routing

Conversation

@SMI-Lab-Inha

@SMI-Lab-Inha SMI-Lab-Inha commented Nov 17, 2026 •

Copy link
Copy Markdown
Owner

Summary

Three fixes to how the armour friction model is chosen.

Before After
Sea-state batch default explicit "direction_tied": never warned, would not follow the planned default change None: takes the library default and its DirectionTiedFrictionWarning
"auto" falls back to direction-tied on a non-planar path only a provenance limitation FrictionModelFallbackWarning, once per layer
Planarity test with a static bend judged against the largest curvature, so a static bend hid the cycles normal to it judged against the range about the mean (floor 1e-3 of the peak)

The library default stays "direction_tied"; this PR does not change it.

1. The batch takes the library default

  • SeaStateBatchOptions.friction_model now defaults to None and is passed through to compute_fatigue. The batch and cablexsec-batch warn on non-planar records, as compute_fatigue does, and will follow the planned default change.
  • New constant cablexsec.analysis.fatigue.DEFAULT_FRICTION_MODEL = "direction_tied". The analysis-level and API compute_fatigue both read it.
  • Results are unchanged bit for bit. The manifest and the assessment digests record the model the default resolves to, so they are unchanged too and will change with the default.
  • With workers > 1, warnings from the spawned workers used to appear only on the workers' standard error. They are now recorded in the worker and issued again in the caller. A category that cannot be pickled travels as a UserWarning with its name in the message.

2. "auto" warns when it keeps the direction-tied law

When the distributed model does not cover a layer on a non-planar path, "auto" keeps the direction-tied law. The causes are a rate-dependent friction law, a rigid interface (ξ ≥ 1) or a stick modulus that changes over the record. compute_fatigue and wire_stress_field now warn in that case (FrictionModelFallbackWarning, a UserWarning, exported from cablexsec). The provenance limitation is kept.

3. Planarity relative to the cycles

curvature_path_out_of_plane_ratio divides the distance from the bending line through the origin by min(peak, max(spread, 1e-3 peak)). Here spread is the largest distance of a sample from the mean curvature.

Path Before After
static 0.05 1/m, ±4e-5 1/m normal cycles 8e-4 (planar) 0.8
static 0.05 1/m, ±4e-4 1/m normal cycles 8e-3 1.0
static bend with cycles in its own plane, any plane round-off < 1e-10
centred ellipse b/a, circle, zero-mean planar paths b/a, 1, round-off unchanged
nearly constant curvature in an oblique plane, six significant digits planar planar (< 1e-3)

The 1e-3 floor keeps the rounding of output files (at most 5e-4 at six digits) from making a static path non-planar. Cycles normal to a static bend count from 1e-6 of it.

Outcome check: I wrapped the function to log every changed verdict. Over the 1 203 tests that reach it, and over the shipped fatigue examples and tutorials (demo_05, both long_term_*, tutorials 03 and 04), only the new checks change their verdict.

Tests

  • test_out_of_plane_ratio: a static bend with normal cycles, in-plane cycles in three planes, a rounded oblique static bend and a constant path.
  • New test_auto_sees_cycles_normal_to_a_static_bend (compiled): "auto" takes the distributed model where the old ratio said planar.
  • The fallback tests (rigid interface, rate-dependent law with compute_fatigue and wire_stress_field, varying stick modulus) expect the warning, reported at the caller's line.
  • New test_no_fallback_warning_on_planar_paths_or_explicit_models.
  • New test_batch_friction_model_follows_the_library_default (workers 1 and 2): the warning reaches the caller, damage matches an explicit "direction_tied" run (bit for bit in process), and the manifest, input digest and assessment id are equal.

Docs

CHANGELOG.md (Fixed), local analysis guide Section 9 (batch default, ratio definition, fallback warning), glossary (warning classes).

Gates

Gate Result
ruff check, ruff format --check clean
mypy (src) 0 errors
pytest, numba 4379 passed, 4 skipped
pytest, CABLEXSEC_DISABLE_NUMBA=1 4265 passed, 118 skipped

No validation row changes: none uses the batch default, "auto" or the planarity ratio. The branch is rebased on #13 and #16. run_validation.py regenerated on the branch differs from the committed report only in round-off cells within their tolerance classes, so the committed report is kept unchanged.

Review

Codex (round 2, after the rebase) flagged that six significant digits round by up to 5e-6 of a value, not 5e-7, so the 1e-3 spread floor could call a rounded constant curvature non-planar (1.3e-3 in its example). Fixed in d9b8b92: the floor is now 1e-2, which gives at most 7.1e-4 (3.2e-4 over a scan of 721 angles and 97 magnitudes), and the reviewed case is in the test. Round 3: no findings.

@SMI-Lab-Inha

Copy link
Copy Markdown
Owner Author

@codex review

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 17, 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-17T13:25:03.518324Z f319cae 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 17, 2026 •

Copy link
Copy Markdown

Documentation build overview

📚 CableXSec | 🛠️ Build #35959014 | 📁 Comparing 576c773 against latest (240bf9c)

  🔍 Preview build  

17 files changed · ± 17 modified

± Modified

@chatgpt-codex-connector

Copy link
Copy Markdown

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

Reviewed commit: 57f94d52f8

ℹ️ 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 force-pushed the fix/friction-model-routing branch from 57f94d5 to 6db4b75 Compare November 17, 2026 12:46
@SMI-Lab-Inha

Copy link
Copy Markdown
Owner Author

@codex review

@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: 6db4b751c4

ℹ️ 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/cablexsec/analysis/fatigue.py Resolved
@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. Bravo.

Reviewed commit: c2e28d281c

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

Copy link
Copy Markdown
Owner Author

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Delightful!

Reviewed commit: f319cae741

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

The sea-state batch set friction_model="direction_tied" explicitly, so
DirectionTiedFrictionWarning, which compute_fatigue issues only when the
model is left at its default, never fired in the batch or cablexsec-batch,
and the batch would not follow the planned change of the default.
SeaStateBatchOptions.friction_model now defaults to None and the batch
passes it through. The library default is unchanged ("direction_tied", new
constant DEFAULT_FRICTION_MODEL), so results are unchanged bit for bit; the
manifest and the assessment digests record the model the default resolves
to and are unchanged too. Warnings of spawned worker processes, shown only
on the workers' standard error before, are issued again in the caller.

friction_model="auto" kept the direction-tied law silently (only a
provenance limitation) when the distributed model did not cover a layer on a
non-planar path: a rate-dependent friction law, a rigid interface or a
stick modulus that changes over the record. It now warns once per layer
(FrictionModelFallbackWarning) from compute_fatigue and wire_stress_field.

curvature_path_out_of_plane_ratio judged the out-of-plane distance against
the largest curvature, so a static bend hid cycles normal to it (0.05 1/m
with 4e-5 1/m normal cycles: 8e-4, planar). The distance is now judged
against the smaller of the largest curvature and the largest distance from
the mean curvature, floored at 1e-3 of the largest curvature so that a
nearly constant curvature written with six significant digits stays
planar: that path is 0.8 out of plane. Paths without a static offset keep
their ratio. Over the 1203 tests that reach the planarity test and the
shipped fatigue examples and tutorials no verdict changes except in the new
checks.

Signed-off-by: Jae Hoon Seo <jaehoon.seo@inha.ac.kr>
Six significant digits round each curvature component by up to 5e-6 of
the value (half a unit in the last digit of a mantissa near 1), not 5e-7,
so a nearly constant curvature written that way could read up to 7e-3 out
of plane against a floor of 1e-3 and switch "auto" to the distributed
model. The floor of the range is now 1e-2 of the largest curvature: such a
path is at most 7.1e-4 out of plane (3.2e-4 over a scan of angles and
magnitudes), and cycles normal to a static bend count from 1e-5 of it. The
test scans the worst rounding case over angles and magnitudes.

Signed-off-by: Jae Hoon Seo <jaehoon.seo@inha.ac.kr>
Signed-off-by: Jae Hoon Seo <jaehoon.seo@inha.ac.kr>
@SMI-Lab-Inha
SMI-Lab-Inha force-pushed the fix/friction-model-routing branch from f319cae to 576c773 Compare November 17, 2026 14:44
@SMI-Lab-Inha
SMI-Lab-Inha merged commit 6749bcf into dev Nov 17, 2026
12 checks passed
@SMI-Lab-Inha
SMI-Lab-Inha deleted the fix/friction-model-routing branch November 17, 2026 15:56
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