Skip to content

fix(friction): no endless distributed solve at near-zero contact pressure - #83

Merged
SMI-Lab-Inha merged 1 commit into
devfrom
fix/distributed-near-zero-pressure
Dec 4, 2026
Merged

SMI-Lab-Inha merged 1 commit into
devfrom
fix/distributed-near-zero-pressure

Conversation

@SMI-Lab-Inha

Copy link
Copy Markdown
Owner

Problem

With friction_model="distributed", or "auto" on a non-planar curvature path, compute_fatigue never returned for an unclamped layer at zero tension. I found this while switching the default to "auto": test_isothermal_limit_is_bitwise_fatigue ran for more than 20 minutes instead of 11 s.

The cause is the distributed model's scaling. It splits every sample step into substeps of at most max_increment × the slip-onset curvature $\kappa_{on}$, and

$$ \kappa_{on} \propto p_{ref}, $$

the reference contact pressure. The 66 kV template has no manufacturing clamping. At zero tension under the solved contact model, its contact pressure is round-off:

Quantity Value
reference pressure $p_{ref}$ 5.3e-10 Pa
slip-onset curvature $\kappa_c$ 1.1e-18 1/m
substeps for a 50-sample record about 1e17

The existing guard returned zero friction only for a pressure of exactly zero.

Fix

  1. Round-off pressure counts as zero. A reference pressure at or below PRESSURE_ROUNDOFF_FRACTION = 1e-14 of the wire modulus (2 mPa for steel) takes the existing zero-pressure path: no friction, as for an exact zero and as in the direction-tied law. Real clamping pressures are kPa to MPa.

  2. Bounded work. _substep_count applies the kernels' subdivision rule before solving. It forms each step the way the kernels do and skips repeated samples as they do, so its count equals theirs. A record that would exceed its budget is refused with a CableInputError that names $\kappa_{on}$ and the pressure. The budget is

    $$
    \max\left(\mathrm{MAX_SUBSTEPS_PER_SAMPLE}\cdot n,\ \mathrm{MIN_SUBSTEP_BUDGET}\right) = \max\left(10,000,n,\ 10^6\right),
    $$

    for a record of $n$ samples. A normal record needs about 100 per sample, for example 90 on the 66 kV template's inner armour at its clamping. The floor admits a few coarse samples, such as the rig-test load path of test_long_specimen_zone_tends_to_distributed_law: 2 samples, 22 800 substeps, at a real 2 MPa. A larger max_increment is not offered as a way out: the kernel does not converge on steps of 1e7 $\kappa_{on}$.

  3. "auto" falls back. In the fatigue route, wire_stress_field and neutral_axes, "auto" keeps the direction-tied law for such a layer and emits FrictionModelFallbackWarning, as it already does for a rigid interface or a varying stick modulus.

  4. New functions. distributed_substep_count(spec, kx, ky, contact_pressure_Pa=..., max_increment=..., friction_law=...) and distributed_substep_budget(samples) return the count and the budget. Tests check the count against the kernel's own substeps.

Effect on results

  • A record within its budget gives the same result as before, bit for bit. The reference pressure changes only where it was at round-off, and every such case hung.
  • Only a record above its budget changes. It is now refused under "distributed", or computed with the direction-tied law under "auto".
Case (66 kV template, 50 samples, biaxial) Before After
zero tension, solved contact, "auto" did not return 0.06 s (direction-tied 0.06 s)
thermal state at zero tension, "auto" did not return 0.06 s

Tests

New file tests/test_distributed_near_zero_pressure.py with six analytical_sanity tests:

  • round-off pressures (5.3e-10 Pa and the floor itself) give the exact-zero result, with no substeps;
  • the substep count equals the kernel's at increments 0.1, 0.5 and ∞;
  • a coarse 3-sample record above 10 000 per sample but within the floor is solved, its count again equal to the kernel's;
  • a real but tiny pressure (1e-7 of the clamping) is refused quickly rather than solved;
  • "auto" falls back with the warning, bit-equal to an explicit "direction_tied", while "distributed" raises;
  • the original hanging case completes and agrees with direction-tied to 1e-9.

validation_report.md: analytical_sanity 1426 → 1432, the only change.

The local-analysis guide (distributed-model cost paragraph) and the CHANGELOG describe the pressure floor and the substep budget.

Checks

  • full suite, 4 workers;
  • ruff check src tests examples validation release doc and ruff format --check;
  • mypy: no issues in 124 files.

@codex review

…sure

The distributed friction model subdivides every sample step in units of
the slip-onset curvature, which is proportional to the reference contact
pressure. An unclamped layer at zero tension (the 66 kV template under
the solved contact model) returns a pressure of round-off size, about
5e-10 Pa, and a 50-sample biaxial record then needed some 1e17
substeps: compute_fatigue with friction_model="distributed", or "auto"
on a non-planar path, never returned.

A reference pressure at or below PRESSURE_ROUNDOFF_FRACTION (1e-14) of
the wire modulus now counts as zero, as an exact zero already did (no
friction, as the direction-tied law). A record that would take more
substeps than its budget, MAX_SUBSTEPS_PER_SAMPLE (10 000) per sample
and at least MIN_SUBSTEP_BUDGET (1 000 000), is refused with a
CableInputError naming the slip-onset curvature, and "auto" (fatigue,
wire stress field, neutral axes) keeps the direction-tied law for such
a layer with FrictionModelFallbackWarning. distributed_substep_count
and distributed_substep_budget give the kernels' count and the budget.
Records within their budget give the same results as before, bit for
bit.

Signed-off-by: Jae Hoon Seo <jaehoon.seo@inha.ac.kr>
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Dec 4, 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-12-04T09:29:54.681273Z 4704ee0 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

📖 2 files modified


Preview · build overview · CableXSec · built Dec. 4, 2026, 9:29 a.m. UTC

@chatgpt-codex-connector

Copy link
Copy Markdown

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

Reviewed commit: 4704ee04e5

ℹ️ 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 636fcf6 into dev Dec 4, 2026
14 checks passed
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