Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -484,6 +484,14 @@ All notable changes to CableXSec are recorded in this file. The format follows
the next free slots, and a worker without a free slot or a writable folder gets a temporary
cache. Results are unchanged, and runs go to whichever worker is free, as before.

- An interface of the radial section is open when its contact carries no line force, as the
contact solver decides it (`RadialSectionResult.interface_open`, `open_interfaces`); the
how-to recipe and the coiling check counted gaps above 1e-9 m. A closed contact reports
the round-off of the linear solve as its gap: about 1.5e-10 m on two interfaces carrying
1.1 MN/m of the 66 kV template at 100 kN and a sealed 2 MPa, within the solver's own
complementarity tolerance in metres (2e-10 to 4e-10 m there). macOS runs crossed 1e-9 m and
printed "open gaps 1" against the page's 0.

- `SectionLaw.from_cable` reads the cable's own materials (its `materials:` block) when the law
is built and every time it is evaluated. Outside `simulate_bending_test` it read the library
instead, and a layer whose material the library lacks silently dropped out of the stiffness
Expand Down
5 changes: 4 additions & 1 deletion doc/howto.md
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,10 @@ twist free: strain 378 ue, twist 6.91 mrad/m, torque 0.0 N m
```

`solve_cable_radial_state` takes trefoil cores and the declared manufacturing
clamping. Here the external pressure acts on the outer sheath with the
clamping. An interface is open when its contact carries no line force
(`result.open_interfaces`), as the contact solver decides it: the reported gap
of a closed contact is the round-off of the linear solve (about 1e-10 m here),
not a measure of openness. Here the external pressure acts on the outer sheath with the
{term}`annulus` sealed; `flooded_pressure_Pa` floods it. `solve_contact_qp` and
`solve_concentric_section` accept concentric layers only and leave out the
{term}`manufacturing clamping`. All three solve a state of tension, twist,
Expand Down
4 changes: 1 addition & 3 deletions doc/howto/scripts/howto_02_contact_state.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,6 @@

import math

import numpy as np

import cablexsec as cx

# 1. Full cable, trefoil cores included: tension and external pressure.
Expand All @@ -23,7 +21,7 @@
print(
f"T {tension / 1e3:.0f} kN, sealed p_ext {pressure / 1e6:.0f} MPa: "
f"strain {state.result.axial_strain * 1e6:.0f} ue, "
f"open gaps {int(np.count_nonzero(state.result.interface_gap_m > 1e-9))}"
f"open gaps {len(state.result.open_interfaces)}"
)
for name in contact:
print(
Expand Down
15 changes: 3 additions & 12 deletions src/cablexsec/analysis/coiling.py
Original file line number Diff line number Diff line change
Expand Up @@ -126,9 +126,6 @@
#: and screens lie at 10-50 deg.
NEAR_HOOP_LAY_ANGLE_DEG = 75.0

#: Gap [m] above which a contact of the twisted section counts as open.
OPEN_GAP_M = 1.0e-9

_PROVENANCE = Provenance(
method="coiling: twisted radial-axial-torsional section (free axial) with "
"rotating bending, slip-front friction and local wire bending on fixed fibres; "
Expand Down Expand Up @@ -509,15 +506,9 @@ def compute_coiling(
)
else:
layers_out[layer.name] = replace(partial, utilisation=buckling)
# A contact that carries a load reports a gap of round-off size (1e-18 to
# 1e-15 m); an open one a gap of a solved size (0.1 mm and more here).
open_ifaces = tuple(
"/".join(name)
for name, gap in zip(
result.interface_names, result.interface_gap_m, strict=True
)
if gap > OPEN_GAP_M
)
# Open or closed as the contact solver decides it (no line force), not by
# the reported gap, whose round-off follows the linear algebra.
open_ifaces = tuple("/".join(name) for name in result.open_interfaces)
from cablexsec.analysis.components import ( # noqa: PLC0415
capacity_utilisation,
compute_component_response,
Expand Down
27 changes: 27 additions & 0 deletions src/cablexsec/mechanics/radial_solution.py
Original file line number Diff line number Diff line change
Expand Up @@ -275,6 +275,33 @@ def p1_plus_p2(self, name: str) -> float:
inner, outer = self.helical_face_pressure_Pa[name]
return inner + outer

@property
def interface_open(self) -> NDArray[np.bool_]:
"""Whether each interface is open: its contact carries no line force.

The contact solver decides it (the complementarity of
:func:`solve_lcp`): an open contact has exactly zero reaction, a
closed one a positive line force. The reported gap of a closed
contact is the round-off of the linear solve, of the order of the
solver's complementarity tolerance in metres, ``1e-8`` of the scaled
problem times the square root of the contact flexibility (1e-10 to
4e-10 m on the 66 kV template), and it moves with the platform's
linear algebra; so a gap threshold would classify a closed contact by
its noise. ``interface_gap_m`` keeps the reported gaps.
"""
return np.asarray(self.interface_line_force_N_per_m <= 0.0)

@property
def open_interfaces(self) -> tuple[tuple[str, str], ...]:
"""Names of the open interfaces (:attr:`interface_open`)."""
return tuple(
name
for name, is_open in zip(
self.interface_names, self.interface_open, strict=True
)
if is_open
)


class RadialSection:
"""Assembled section; solve repeatedly for different load states.
Expand Down
57 changes: 57 additions & 0 deletions tests/test_open_interfaces.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
# SPDX-License-Identifier: Apache-2.0
# Copyright (c) 2026 Jae Hoon Seo, SMI Lab, Inha University
"""Open and closed contacts of the radial section, as the solver decides them.

The how-to recipe counted gaps above 1e-9 m as open. A closed contact reports
a gap that is the round-off of the linear solve: on the 66 kV template at
100 kN and a sealed 2 MPa it is about 1.5e-10 m on two interfaces that carry
1.1 MN/m, within the solver's own complementarity tolerance in metres
(1e-8 of the scaled problem times the square root of the contact
flexibility: 2e-10 to 4e-10 m here) and close enough to 1e-9 m that another
platform's linear algebra crossed it (one macOS run printed "open gaps 1").
"""

from __future__ import annotations

import numpy as np
import pytest

import cablexsec as cx


@pytest.fixture(scope="module")
def states():
cable = cx.load_cable(cx.iea_task49_66kv_yaml_path())
return {
p: cx.solve_cable_radial_state(cable, 100e3, external_pressure_Pa=p).result
for p in (0.0, 2e6)
}


def test_closed_contacts_are_closed_whatever_their_round_off_gap(states):
closed = states[2e6]
assert closed.open_interfaces == ()
assert not closed.interface_open.any()
assert float(np.min(closed.interface_line_force_N_per_m)) > 1e5


def test_open_contact_carries_no_force(states):
result = states[0.0]
assert result.open_interfaces == (("outer_armour", "hdpe_outer_sheath"),)
gap = result.interface_gap_m[result.interface_open]
assert gap.size == 1 and gap[0] > 1e-6 # a solved gap, far above round-off
assert result.interface_line_force_N_per_m[result.interface_open][0] == 0.0


def test_classification_ignores_the_gap_round_off(states):
"""Either side of a gap threshold: a closed contact whose round-off gap is
raised past 1e-9 m stays closed; an open one whose gap is lowered stays
open. Only the line force decides."""
import dataclasses

closed = states[2e6]
noisy = dataclasses.replace(closed, interface_gap_m=closed.interface_gap_m + 5e-9)
assert noisy.open_interfaces == ()
opened = states[0.0]
tight = dataclasses.replace(opened, interface_gap_m=opened.interface_gap_m * 0.0)
assert tight.open_interfaces == opened.open_interfaces
Loading