Repository navigation
fix: an interface is open when its contact carries no line force - #49
Conversation
Codex Review Summary: ✅ CompletedThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 4c719510aa
ℹ️ 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".
|
@codex review |
|
Codex Review: Didn't find any major issues. Chef's kiss. Reviewed commit: ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
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 how-to recipe and the coiling check counted a radial-section interface as open when its reported gap exceeded 1e-9 m. A closed contact reports the round-off of the linear solve as its gap: on the 66 kV template at 100 kN and a sealed 2 MPa, about 1.5e-10 m on two interfaces carrying 1.1 MN/m, within the contact 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 there). macOS runs crossed 1e-9 m and printed "open gaps 1" against the page's 0 (CI runs 44493046003 and 44286053398). The open or closed state is now the contact solver's decision, an exactly zero reaction: RadialSectionResult.interface_open and open_interfaces. The recipe and coiling use them; interface_gap_m keeps the reported gaps. Signed-off-by: Jae Hoon Seo <jaehoon.seo@inha.ac.kr>
The closed-contact gap at the recipe load case is round-off that macOS places above 1e-9 m; the test asserted it below. The force-based classification and the gap perturbation checks stay. Signed-off-by: Jae Hoon Seo <jaehoon.seo@inha.ac.kr>
ff4a98b to
8205a2b
Compare
|
@codex review |
|
Codex Review: Didn't find any major issues. More of your lovely PRs please. Reviewed commit: ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
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". |
Summary
tests/test_howto_recipes.py::test_recipe_output_matches_page[howto_02_contact_state.py]failed on macOS only (dev runs 44493046003, Python 3.11, and 44286053398, Python 3.12). The recipe printedopen gaps 1at 100 kN with a sealed 2 MPa, where the page showsopen gaps 0. The recipe, and the coiling check, counted an interface as open when its reported gap exceeded a bare 1e-9 m.The gaps at that load case
66 kV template, 100 kN,
solve_cable_radial_state, gaps printed in full precision (Windows, CI wheels NumPy 2.4.6 / SciPy 1.17.1):At 2 MPa every contact carries more than 1 MN/m: all four are closed. Their reported gaps are the round-off of the linear solve. They are recomputed as
gap0 + C u + c rfrom a displacement solved to about 1e-7 of its millimetre scale, on a stiff wire stack over soft polymer. The contact solver's own complementarity tolerance (solve_lcp: 1e-8 of the scaled problem), converted to metres with the square root of each contact's flexibility, is 1.9e-10 to 4.3e-10 m here. So the 1.47e-10 m gap is inside the solver's tolerance, and only seven times below the 1e-9 m threshold. Another platform's linear algebra (the macOS NumPy wheels link Accelerate) crossed it.Fix
A gap threshold cannot separate a closed contact from an open one here: the noise of a closed contact's gap is of the same order as any tolerance derived from the solver. A force-based threshold derived from the 1e-8 N/m KKT gate does not work either. Converted with the compliance it gives about 1e-14 m, far below the 1.5e-10 m noise, so it would call the closed contacts open. The solver already decides the state exactly by complementarity: an open contact has a reaction of exactly zero (it is outside the active set), and a closed one has a positive line force (here more than 1e4 N/m).
RadialSectionResult.interface_open(array) andopen_interfaces(names) report the solver's decision: line force ≤ 0.interface_gap_mis unchanged.len(state.result.open_interfaces).analysis.coilinguses the same rule; itsOPEN_GAP_M(1e-9 m) is removed.No validation tolerance, band or result changes; the page output is unchanged.
Tests
tests/test_open_interfaces.pycovers both sides of the boundary:Gates
On cd3b657 before the rebase:
pytest(full suite, venv with the CI wheels,NUMBA_NUM_THREADS=1): 4584 passed, 4 skipped.CABLEXSEC_DISABLE_NUMBA=1: 4469 passed, 119 skipped.After the rebase onto 694331f (dev with #48; only the CHANGELOG conflicted), the affected test files were rerun:
CABLEXSEC_DISABLE_NUMBA=1.python -m mypy: no issues.ruff checkandruff format --check: clean.