diff --git a/CHANGELOG.md b/CHANGELOG.md index 511092a..35f0e81 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,132 @@ All notable changes to CableXSec are recorded in this file. The format follows [Keep a Changelog](https://keepachangelog.com/en/1.1.0/) and the project uses [Semantic Versioning](https://semver.org/spec/v2.0.0.html). +## [0.2.1] - 2026-11-23 + +The Python interfaces are versioned but may change before `1.0.0`. The evidence for +every item below is in +[VALIDATION.md](https://github.com/SMI-Lab-Inha/CableXSec/blob/main/VALIDATION.md); its +generated table is reproduced by `python validation/scripts/run_validation.py`. The +entries under Changed for the normal wire curvature and under Added for the Zeidan +(2025) input change results; the new options default to the 0.2.0 behaviour. + +### Added + +- `bonded_face: outer` on the outermost helical layer (gap G8): the outer face + of the armour is bonded to the polymer outside it (a sheath extruded onto the + wires with no tape, or a bitumen or compound bond) and does not slip. + - The wires slide on their inner face only: the friction-setting pressure + keeps the inner face's share of the bounded radial chain. + - The bond is an elastic spring through the polymer outside, an inner-loaded + layered annulus free at the cable surface + (`annulus_mode1_compliance_inner`) plus the strip concentration. It keeps + `xi_bond = K_b / (K_b + EA_w sin^2(a) / r_h^2)` of the layer's + plane-section stiffness in full slip (`bonded_face_terms`, + `bonded_face_ei`). The stuck layer is unchanged. At a zero lay angle the bond + carries the whole layer: the slider has no stick stiffness and is elastic-only + (no stress, slip or friction work; `elastic_only_history`). + - Used by the bending law (`compute_mkappa`, `SectionLaw`, the exported law) + and `compute_stiffness` (whose `ei_min_Nm2` then includes the bond). The + wire-stress, fatigue and capacity routes refuse such a cable, because they + would miss the bond's share of the wire force. Bounded contact model only, + without winding stress or pretension. + - The Zeidan (2025) input declares it. Its construction shows no tape between + the outer armour and the sheath, and the bonded state is the one that + matches the measured post-slip slope of the stabilised loops. It is an + identified input, not a published one. + +- `CoreFrictionSpec(core_core_coupling="relative")`: a coupled intralayer slip + model of laid cores. Neighbouring cores touch at the same axial position, so + the friction between them acts on their relative slip, while the filler and + ring contacts keep the slip of each core against the plane section. + - The stations of the cores at one axial position form a group whose + intralayer friction shares sum to zero. The intralayer share of a station + has the constant Coulomb bound `σ0 μ_cc (q_cc/q) |sin β| min(ψ, π/n)`, the + interlayer share the Papailiou cap with `μ_a = (μ_cf q_cf + μ_cs q_cs)/q`. + The return map is the closest point of the group + (`cablexsec.mechanics.station_coupling`, a NumPy path and a numba kernel + that agree to round-off). + - Three cores in core–core contact only: same slip onset, the largest frozen + friction stress 2/3 and the full-slip moment `√3/2` of the default law, + full slip at `2π/(3√3) = 1.209` times the onset instead of `π/2`. + - Verified against an independent field solver of the coupled axial + equilibrium of the cores (`validation/scripts/coupled_core_slip_reference.py`): + onset, full-slip curvature, moment–curvature, friction-force distribution + and reversal loop, with and without interlayer friction + (`tests/test_core_coupled_slip.py`). + - Routes: `core_friction_history`, `compute_mkappa`, the bending-law export + (group cap and transitions), the section properties, the core kinematics, + the component states and the screen, tape and sheath fatigue of the cores. + It is a direction-tied law: `friction_model="distributed"` raises and + `"auto"` keeps it on a non-planar path with a `FrictionModelFallbackWarning`. + - New helpers `core_station_history`, `core_station_bounds`, + `core_full_slip_moment` and `core_full_slip_curvature`. + - The default stays `"absolute"`; its results are unchanged, bit for bit. + +### Changed + +- The normal (out-of-surface, weak-axis) local bending of a helical wire follows the + wire's axial slip state. This is a correction and the new default; it changes results. + - Before, every recovery used the curve curvature of the deformed helix, + `cos²α cos2α` per unit projected curvature (Out and von Morgen 1997 Eq. 41; Leroy + and Estrier 2001 Eq. 13), in every slip state. That value belongs to a wire that + carries no friction stress. + - The bending strain of a wire is set by the rotation of its cross-section per unit + material length. The helix starts with the normal curvature `sin²α / r`, so the + axial strain `σ_f / E` that the wire carries adds `(sin²α / r) σ_f / E` + (`cablexsec.mechanics.wire_stress.slip_state_normal_curvature`). A stuck wire with + the plane-section strain takes `cos⁴α`; with the stick coefficient ξ, + `cos²α cos2α + ξ sin²α cos²α`; a wire without friction stress keeps `cos²α cos2α`; + a wire in Coulomb slip keeps that slope and carries the offset of its friction + stress. On the outer face the term is `(t/2)(sin²α / r) σ_f`. + - Before, a stuck wire's weak-axis bending stress was low by + `cos⁴α / (cos²α cos2α) − 1`: 3.2 % at 10°, 15.5 % at 20.1° and 96 % at 35°. The + stick and slip limits were checked against an independent finite-element model of + a wire on a bent support (not published). + - It enters the fatigue field (direction-tied, distributed and progressive friction, + compiled and NumPy paths, with any termination increment), `compute_stress`, the + wire-yield capacity, the helix field of `compute_kinematics`, the rig-test gauges, + the laid cores (core normal curvature of `core_kinematics`, the component states and + utilisation), the frictional tape state and the outer-fibre strand-slip parameters + of conductors (stick slope `R cos²α + (d/2) cos⁴α`, friction amplitude times + `1 + (d/2) sin²α / R`). The lateral term `cos α (1 + sin²α)` and the section + stiffness are unchanged. + - `local_bending_fibre_stress`, `local_bending_stress` and `local_bending_amplitude` + take the friction stress and the helix radius as keyword arguments; without them + they return the value of a wire without friction stress, as before. + - Validation row σ_B now checks the three states (μ = 0 against Ménard Eq. 14, a stuck + wire, a slipping wire); its target is unchanged. No other row changes. Tests: + `tests/test_normal_term_slip_state.py`. + - Effect on the power-cable examples is small, because their wires slip in most of each + cycle and `(t/2) sin²α / r` is about 1e-3: on the 66 kV template record of + doc/template_66kv.md Section 4 the largest wire damage rises 0.23–0.27 % (inner + armour) and 0.05–0.06 % (outer armour) in all four model combinations; tutorial 3 + moves by −0.1 % (the governing inner face takes the term with the opposite sign) and + the tutorial and how-to outputs are regenerated. The largest damage of the README quick + start (the Ménard cable at 100 kN) rises 2.0 % (inner) and 1.5 % (outer armour). Riser + armour at 35° in stick takes nearly twice the earlier weak-axis bending stress. + +- **Figures use a MATLAB-style look** (`cablexsec.plotting.style`): + - MATLAB's default line colours in MATLAB's order (`MATLAB_ORDER`; `COLORS` maps the names to those hues); + - a Helvetica or Arial face at 10 pt; + - a closed box with inward ticks on all sides and no grid; + - a square, opaque legend. +- **Labels carry true Greek letters and sub- and superscripts** in the same face (κ, EI_min, σ_A, m⁻¹), with numerals upright. The new `style.LABELS` holds the standard axis labels. +- **The tutorial and how-to scripts apply the style.** Their figures were plain matplotlib defaults before; they are regenerated. The examples follow the same labels. + +### Known limitations + +- A bonded outer face (`bonded_face: outer`) is supported by the bending law and + `compute_stiffness` only. The wire-stress, fatigue and capacity routes refuse such a + cable, so `compute_mkappa` cannot check its curvature history against the wire-yield + curvature and warns that it does not. +- The bonded state of the Zeidan (2025) cable is identified from its measured loops, not + published. With it, Z-ID passes and Z-EI fails narrowly (`EI_min` 10.09 kN·m² against + a measured slip slope of 8.65–9.70 kN·m² in the plotted curvature). The predicted + cycle work differs from the measured by +9.9 / −4.7 / −9.0 % at 30 / 50 / 60 mm. +- The measured comparisons that failed in 0.2.0, other than Z-ID, still fail; their + tolerances are not relaxed. + ## [0.2.0] - 2026-11-21 The Python interfaces are versioned but may change before `1.0.0`. The evidence for @@ -1180,5 +1306,6 @@ generated table is reproduced by `python validation/scripts/run_validation.py`. - A passing test does not establish that the model predicts every physical cable construction or a validated service life. +[0.2.1]: https://github.com/SMI-Lab-Inha/CableXSec/releases/tag/v0.2.1 [0.2.0]: https://github.com/SMI-Lab-Inha/CableXSec/releases/tag/v0.2.0 [0.1.0]: https://github.com/SMI-Lab-Inha/CableXSec/releases/tag/v0.1.0 diff --git a/CITATION.cff b/CITATION.cff index efffee6..36964f9 100644 --- a/CITATION.cff +++ b/CITATION.cff @@ -23,8 +23,8 @@ authors: repository-code: "https://github.com/SMI-Lab-Inha/CableXSec" url: "https://github.com/SMI-Lab-Inha/CableXSec" license: Apache-2.0 -version: 0.2.0 -date-released: 2026-11-21 +version: 0.2.1 +date-released: 2026-11-23 keywords: - dynamic power cable - cross-section mechanics diff --git a/DEVELOPMENT.md b/DEVELOPMENT.md index a42e215..1e44776 100644 --- a/DEVELOPMENT.md +++ b/DEVELOPMENT.md @@ -100,7 +100,7 @@ with absolute `https://github.com/SMI-Lab-Inha/CableXSec/blob/main/...` URLs. python -m build --outdir dist python -m twine check dist/* python -m venv wheel-test -wheel-test\Scripts\python -m pip install dist\cablexsec-0.2.0-py3-none-any.whl +wheel-test\Scripts\python -m pip install dist\cablexsec-0.2.1-py3-none-any.whl wheel-test\Scripts\python release\smoke_test_wheel.py --version 0.2.0 ``` diff --git a/README.md b/README.md index c7398ad..dd1e668 100644 --- a/README.md +++ b/README.md @@ -17,7 +17,7 @@ damage of the armour, the conductor and the metallic sheaths. It reads the results of global analyses (CableDyn, RIFLEX, and time-history CSV exports such as those of OrcaFlex) and turns them into local stresses and damage, and it exports a hysteretic bending law for use in global analysis. The -current release is `v0.2.0`; interfaces are versioned and may change before `1.0.0`. +current release is `v0.2.1`; interfaces are versioned and may change before `1.0.0`. ## What CableXSec does @@ -74,7 +74,7 @@ Install the release wheel from the 3.12), or install straight from the repository: ```powershell -python -m pip install "cablexsec[fast] @ git+https://github.com/SMI-Lab-Inha/CableXSec.git@v0.2.0" +python -m pip install "cablexsec[fast] @ git+https://github.com/SMI-Lab-Inha/CableXSec.git@v0.2.1" ``` The `fast` extra adds `numba` for the compiled slip-stress and rainflow kernels; without it the @@ -106,8 +106,8 @@ for layer, damage in fatigue.D_total_per_wire.items(): ```text EA = 280 MN, EI full slip = 3571 N m^2, EI no slip = 189.8 kN m^2 peak moment 541 N m, friction work 218.0 J/m over the history -inner_armour: largest Miner damage 1.774e-06 over the record -outer_armour: largest Miner damage 3.005e-07 over the record +inner_armour: largest Miner damage 1.809e-06 over the record +outer_armour: largest Miner damage 3.050e-07 over the record ``` For a set of CableDyn sea-state runs, `cablexsec-batch batch.json --output-directory results` @@ -154,7 +154,7 @@ in [`validation/`](validation/README.md), including the data of the companion jo ## Citation -If you use CableXSec in academic work, please cite the software release (CableXSec 0.2.0); +If you use CableXSec in academic work, please cite the software release (CableXSec 0.2.1); [CITATION.cff](CITATION.cff) contains the entry (GitHub **Cite this repository**) and the manual's [How to cite](https://cablexsec.readthedocs.io/en/latest/citing.html) page gives BibTeX. The journal article that describes the method is under review; its reference will be diff --git a/VALIDATION.md b/VALIDATION.md index f55c02f..45ab27c 100644 --- a/VALIDATION.md +++ b/VALIDATION.md @@ -41,7 +41,7 @@ afterwards: a comparison that misses its target is reported as failed. | **TQ-SV** | Saint-Venant twist rigidity with free warping: rectangle; bonded annulus as a mirrored 60° sector | series solution; polar moment | 1.0e-4; −1.5e-8 | <3e-4; <1e-6 | Pass | | **TQ-FT** | Twist-rate wire stress of the fatigue path: stress and damage, torque and tension carried by the wires, mirror lay, zero twist | Knapp (1981), Eqs. 2, 11; `K_et`, `K_tt` | 4.5e-15; 2.2e-16; 0; 0 | <1e-12; <1e-12; <1e-12; 0 | Pass | | **A11** | Moment–curvature energy closure | loop area against closed form | 0.082 % | <0.1 % | Pass | -| **σ_B** | Radial-fibre bending stress | Ménard and Cartraud (2023), Eq. 14 | 0 | <1e-6 % | Pass | +| **σ_B** | Radial-fibre bending stress: no friction stress (μ = 0), stuck wire, slipping wire; the normal curvature follows the slip state | Ménard and Cartraud (2023), Eq. 14 (μ = 0); `cos²α cos2α + ξ sin²α cos²α` (stuck); Eq. 14 + `(sin²α / r) σ_f / E` (slipping) | 0; 0; 0 | <1e-6 % each | Pass | | **M-rec, M-rec-3core** | Assembled per-wire moment against the section engine | cross-engine | 0.000 % | <2 % | Pass | | **MK-Tcyc** | Moment–curvature law with tension cycling inside the bending cycles; work balance under the changing friction bound | fatigue-path friction stress, same kernels | 3.4e-16; 8.9e-16 | <1e-12 | Pass | | **MX-scale** | Exported bending law with a slip scaling variable: bound homogeneity, scaled group yield curvatures, tension cycle inside the bending cycles | `compute_mkappa` at another tension; contact-tension history | 5.5e-16; 1.2e-13; ratio 1.21 | <1e-12; <1e-9; ≤1.25 | Pass | @@ -65,8 +65,8 @@ afterwards: a comparison that misses its target is reported as failed. | **BM1** | Full-slip bending stiffness EI_min, no calibration | Ménard and Cartraud (2023), Table 3 | 0.6 % (3571 N·m²) | <15 % | Pass | | **BM1-loop** | ±0.10 m⁻¹ moment–curvature loop predicted with the clamping identified on the measured ±0.05 cycle work (190 kPa), four-point arrangement | Ménard and Cartraud (2023), Fig. 16 | ordered RMSE 5.45 %; cycle work 44.4 vs 62.3 J/m (−28.8 %) | RMSE <5 %; work within 10 % | Fail | | **BM1-ID** | Laid cores, wedged trefoil and filler profiles: initial pressure identified on range (b), five ranges predicted | Ménard and Cartraud (2023), Fig. 16 | (a) +28.5 %, (c) +26.2 %, (d)–(f) within 16 % | work ±20 %, RMSE <10 % | Fail | -| **Z-EI** | Measured stick secant against the no-slip EI_max; slip slope against EI_min, 112 mm three-core cable, zero tension | Zeidan (2025), thesis Figs 5.5–5.6 | stick 141–240 kN·m² vs EI_max 311.1 kN·m² (plane-section 335); diagnosed on for the shear-stack rule | stick ≤ EI_max; slip ≥ EI_min | Pass | -| **Z-ID** | Four-point loops at 30–60 mm in the test arrangement: pressure identified on 40 mm, three amplitudes predicted | Zeidan (2025), Fig. 5.6 | P0 760 kPa; work +10.4 to −9.6 %, RMSE 13.7–15.4 %, moment range −33 to −46 % | work ±20 %, RMSE <10 %, range ±10 % | **Fail** | +| **Z-EI** | Measured stick secant against the no-slip EI_max; slip slope against EI_min, 112 mm three-core cable, zero tension | Zeidan (2025), thesis Figs 5.5–5.6 | stick 141–240 kN·m² vs EI_max 311.1 kN·m² (plane-section 335); slip 8.65–9.70 (plotted curvature) vs EI_min 10.09 kN·m² with the bonded outer face (2.72 without) | stick ≤ EI_max; slip ≥ EI_min | **Fail** | +| **Z-ID** | Four-point loops at 30–60 mm in the test arrangement: pressure identified on 40 mm, three amplitudes predicted; outer armour face bonded (identified input, gap G8) | Zeidan (2025), Fig. 5.6 | P0 1085.9 kPa; work +9.9 / −4.7 / −9.0 %, RMSE 6.4 / 4.3 / 4.4 %, moment range −4.4 / −8.5 / −8.0 % (30 / 50 / 60 mm; 40 mm RMSE 4.5 %). Both faces sliding: P0 760 kPa, range −33 to −46 % | work ±20 %, RMSE <10 %, range ±10 % | Pass | | **HU-3PB** | Conductor loop, third cycle, three-point arrangement | Hu et al. (2022) | loop area +36.7 % (Papailiou), +64.4 % (KH); transition share 32.8 % / 39.4 % | area ±15 %; share 34 ± 10 points | **Fail** | | **HU-uniform** | Same loop at uniform curvature | Hu et al. (2022) | area +4.9 % (Papailiou) | — | Not comparable | | **WITZ-EI** | Full-slip EI_min of a 2.5-inch flexible pipe, 0 bar, parameter-free | Witz (1996), measured gradients 1190 / 1014 N·m² | 1007 N·m² | 913–1309 N·m² | Pass | @@ -107,20 +107,32 @@ quantities are those of the passing rows. In particular: (BM1-loop); identified on it, the small cycles are up to 29 % high (BM1-ID). The source's 0.3 MPa is a tuning parameter of its own FE model and is not used as an input of the gated rows. The 300-bar Witz loop is too narrow after - identification at 0 bar. On the Zeidan (2025) cable the measured stick slope lies below the - no-slip bound since the armour shear stack stops at its support (Z-EI, diagnosed on), but the - identified loops miss the moment range by a third or more (Z-ID); absolute dissipation - predictions therefore carry the uncertainty shown by WITZ-ID and Z-ID. -- **Known limitation (gap G8, closed for 0.2.0).** - - On a compact, solid-filler three-core cable (Zeidan 2025), the slip-branch tangent is - about 3.5 times softer than measured (Z-ID: 2.5–2.6 against 8.65–9.70 kN·m²). - - With rope fillers (Ménard and Cartraud 2023), the full-slip stiffness is right (BM1). - - Eight mechanisms, each registered and tested with source inputs, were ruled out: - stick-support compliance, residual pressure, neighbour-wire contact, a compacted bundle, - end anchorage, conductor compaction, the metric, and the insulation modulus - (doc/benchmarks.md, "Known limitation: slip-branch stiffness of compact sections"). - - Direction of the error: conservative for curvature-driven quantities, not conservative - for the section moment and the interface loads. + identification at 0 bar. On the Zeidan (2025) cable the identified loops now meet the + registered bands (Z-ID) with the outer armour face bonded; absolute dissipation predictions + carry the uncertainty shown by WITZ-ID and Z-ID. +- **Gap G8 (slip-branch stiffness of compact sections): a bonded outer armour face.** + - With both armour faces sliding, the Zeidan (2025) slip branch is about 3.5 times softer + than measured (2.5–2.6 against 8.65–9.70 kN·m²) and the identified loops miss the moment + range by a third or more. + - The measured loops themselves show what is missing: their dissipation grows linearly with + the amplitude (a friction moment mobilised early and then constant), while their range + grows at 8–11 kN·m², an elastic, non-dissipative stiffness after slip. + - Its source is an armour face that does not slip. Zeidan's sheath sits on the outer armour + with no tape (thesis Table 5.2, Fig. 5.2); with `bonded_face: outer` (an identified input) + the full-slip stiffness is 10.09 kN·m² and Z-ID passes. The rope-filler and taped + constructions (Ménard and Cartraud 2023; Witz 1996) keep both faces sliding and need no + change (BM1, WITZ-EI). Full-scale tests of dynamic cables with bitumen-coated armour + report bending stiffness beyond the stick–slip law and attribute it to the bitumen and to + bonded layers (doc/benchmarks.md); keying by a sheath extruded onto the wires is the + construction identified here for Zeidan's cable. + - Remaining: the bond is about 4–17 % stiffer than the measured slip slope in the plotted + curvature, so the bound row Z-EI fails. The source's own optical deflection profiles + (paper Fig. 18) put the central curvature at 0.78 of the plotted one, which would place + the measured slope above EI_min; the registered row keeps the plotted reading. + - The bonded face is used by the bending law and `compute_stiffness`. The wire-stress, + fatigue and capacity routes refuse it until the bond's share of the wire force is in them. + - The eight mechanisms ruled out earlier are recorded in doc/benchmarks.md ("Known + limitation: slip-branch stiffness of compact sections"). - The termination-corrected (anchored-wire) armour stress is an upper estimate that the published near-termination measurements do not support (SV11-PLANE, SV11-GJ); the sectional result is the one closest to them (median 1.19, 12 of 14 in band, against the 1.18 bound). At diff --git a/doc/benchmarks.md b/doc/benchmarks.md index bb755d9..fe9d2d8 100644 --- a/doc/benchmarks.md +++ b/doc/benchmarks.md @@ -147,7 +147,7 @@ All rows are verification, not validation. Source: the scorecard | CF | A | Laid-core friction: μ = 0 gives the armour-only loop; large μ tangent vs EI_max; full-slip core moment vs closed form; dissipation ≥ 0; rotation equivariance | 0 N·m; < 1e-9; < 5e-3; ≥ 0; < 1e-9 rel. | 0; 1.0e-15; 1.0e-4; 5.0e-6; 5.0e-14 | PASS | | CFW | A | Laid-core contact statics (wedged trefoil and central filler, with and without a filler): radial equilibrium of one core; filler profiles: μ = 0 gives the armour-only loop; full-slip profile moment vs closed form; stick tangent vs `EI_max + E J_f cos³β_f / 2` | < 1e-12 rel.; 0 N·m; < 5e-3; < 1e-9 | 9.5e-17; 0; 1.0e-4; 7.8e-16 | PASS | | A11 | A | Moment–curvature energy closure (loop area vs closed form) | < 0.1% | 0.082% | PASS | -| σ_B | A | Radial-fibre bending stress vs Ménard Eq. 14 | < 1e-6% | 0 | PASS | +| σ_B | A | Radial-fibre bending stress at φ = 0: μ = 0 vs Ménard Eq. 14; stuck wire vs `cos²α cos2α + ξ sin²α cos²α`; slipping wire vs Eq. 14 + `(sin²α / r) σ_f / E` (section NT) | < 1e-6% each | 0; 0; 0 | PASS | | M-rec | I | Assembled per-wire moment vs `compute_mkappa`, single core | < 2% | 0.000% | PASS | | M-rec-3core | I | As M-rec, offset-core geometry | < 2% | 0.000% | PASS | | MK-Tcyc | I | `compute_mkappa` with a contact-tension history cycling inside the bending cycles vs the moment of the fatigue-path friction stress on the same history; work-balance residual over the friction work | < 1e-12 rel.; < 1e-12 rel. | 3.4e-16; 1.1e-15 | PASS | @@ -1553,10 +1553,74 @@ geodesic) and of tension-coupled re-sticking (Kim 2020). Interlocked carcass and Zeta layer types (G2), orthotropic tapes (G3) and an asymmetric, non-Masing loop law (G8) are open. -### Known limitation: slip-branch stiffness of compact sections - -Gap G8 is closed for release 0.2.0 as a documented known limitation. No -mechanism tested with source inputs closes it. Every candidate below was +### Gap G8 after 0.2.0: a bonded outer armour face + +**What the measured loops say, without a model.** On the stabilised Zeidan +(2025) loops (thesis Fig. 5.6) the cycle work grows linearly with the +amplitude: 300, 456, 601 and 763 J/m at 30, 40, 50 and 60 mm, a constant +5.1 / 4.7 / 5.2 kJ/m per 1/m. A friction moment that is mobilised early and +then stays constant does this. The moment range grows at 11.2 / 8.7 / +8.1 kN·m² between the same amplitudes: an elastic stiffness after slip that +does not dissipate. With both faces sliding, the full-slip stiffness is +2.72 kN·m², and a law calibrated to the loop height puts all of that height +into friction and dissipates about twice the measured work. + +**Model.** `bonded_face: outer` on the outermost helical layer: + +- the outer face carries no slip, so the friction-setting pressure keeps only + the inner face's share of the bounded radial chain; +- the bond is an elastic spring through the polymer outside the wires, an + inner-loaded layered annulus free at the cable surface plus the strip + concentration (`annulus_mode1_compliance_inner`, `bonded_face_terms`); +- the stuck layer is unchanged; +- in full slip the bond keeps `xi_bond` of the layer's plane-section + stiffness, added in parallel to the law (`bonded_face_ei`). + +**Zeidan.** The sheath sits on the outer armour with no tape (Table 5.2, +Fig. 5.2). With the outer face bonded: + +- `xi_bond` 0.0395, and the full-slip stiffness goes from 2.72 to + 10.09 kN·m²; +- Z-ID passes: P0 1085.9 kPa identified on the 40 mm work; at 30 / 50 / + 60 mm, work +9.9 / −4.7 / −9.0 %, branch RMSE 6.4 / 4.3 / 4.4 %, moment + range −4.4 / −8.5 / −8.0 %. + +The bonded state is an identified input: it is the one that matches the +measured post-slip slope, and the source does not state the interface. + +**The other measured loops keep both faces sliding**, and their slip slopes +already match: + +- Ménard and Cartraud (2023): range growth 3.67 kN·m² between the ±0.045 and + ±0.096 1/m loops, against EI_min 3.57. The paper mentions absorbent tapes. +- Witz (1996), a flexible pipe with anti-wear and outer tapes: 1014–1190 + against 1007 N·m². + +**The same mechanism in full-scale tests.** Dynamic cables with +bitumen-coated armour show bending stiffness beyond the stick–slip law, which +depends on temperature, frequency and cycling, and which the authors attribute +to the bitumen and to bonded layers: + +- Stamelos et al. (2026), Marine Structures 109, 104062; +- Komperød et al. (2017), OMAE2017-61103; +- Mackay and Thies (2026), OMAE2026-175041. + +**Remaining.** + +- The bond is 4–17 % stiffer than the measured slip slope in the plotted + curvature, so the bound row Z-EI fails (8.65–9.70 against 10.09 kN·m²). The + source's optical deflection profiles (paper Fig. 18) give a central + curvature of 0.78 times the plotted one, which would put the measured slope + above EI_min; the registered row keeps the plotted reading. +- The bond enters the bending law and `compute_stiffness` only. The + wire-stress, fatigue and capacity routes refuse a bonded face until they + carry the bond's share of the wire force. + +### Known limitation: slip-branch stiffness of compact sections (0.2.0) + +Gap G8 was closed for release 0.2.0 as a documented known limitation; the +section above supersedes it. No mechanism tested with source inputs closed it +then. Every candidate below was registered (formulation, predictions and pass rules) before it was run, with held-out rows chosen in advance. No band, target or source input was changed. @@ -2980,6 +3044,31 @@ No input is changed and the band is not tightened: the model reproduces the source's analytical model term by term, and nothing published locates the FE's or the test's smaller direction dependence. +## Normal wire curvature and the slip state (NT) + +The normal (out-of-surface, weak-axis) local bending of a helical wire is +`cos²α cos2α p_n + (sin²α / r) σ_f / E` per unit material length: the curve +curvature of the deformed helix (Out and von Morgen 1997, Eq. 41; Leroy and +Estrier 2001, Eq. 13) plus the initial normal curvature `sin²α / r` times the +axial strain `σ_f / E` the wire carries +(`cablexsec.mechanics.wire_stress.slip_state_normal_curvature`). Earlier +releases used `cos²α cos2α` in every slip state. The stick and slip limits were +checked against an independent finite-element model of a wire on a bent +support (not published). Tests `tests/test_normal_term_slip_state.py`. + +| ID | Class | Check | Target | Result | Status | +| --- | --- | --- | --- | --- | --- | +| NT-1 | A | Stuck wire, `ξ = 1`, monotonic ramp below the onset (10°, 20.1°, 35°; compiled and NumPy field): outer-face bending over `E (d/2) p_n` against `cos⁴α` | 1e-12 relative | PASS | PASS | +| NT-2 | A | Stuck wire with `ξ` = 0.35 and 0.8: `cos²α cos2α + ξ sin²α cos²α` | 1e-12 relative | PASS | PASS | +| NT-3 | A | `μ = 0` (no friction stress), direction-tied, distributed and progressive laws, biaxial history: the field equals Ménard Eq. 14 (`cos²α cos2α`) | 1e-12 of scale | PASS | PASS | +| NT-4 | A | Partial slip, cyclic biaxial history, three friction laws, compiled and NumPy: field minus the Eq. 14 value equals `(d/2)(sin²α / r) σ_f`; with a termination increment, `σ_f` includes it | 1e-12 of scale | PASS | PASS | +| NT-5 | A | Spring-slider on a planar history: stick steps take the slope `cos²α cos2α + ξ sin²α cos²α`, slip steps `cos²α cos2α` (no transition on a sample) | 1e-9 relative | PASS | PASS | +| NT-6 | A | Lateral term `cos α (1 + sin²α)` unchanged | 1e-12 of scale | PASS | PASS | +| NT-7 | A | Compiled assembly with friction, termination increment and a modulus history against the NumPy expressions | 1e-12 of scale | PASS | PASS | +| NT-8 | A | `compute_stress` (μ = 0 and the shipped μ), capacity bending (round and rectangular) against the closed form with the per-wire friction stress | 1e-12 | PASS | PASS | +| NT-9 | A | Laid cores: normal gradient `cos⁴β κ_r` stuck, `cos²β cos2β κ_r` free, `cos²β cos2β κ_r + (sin²β / r_c) ε_b` frictional | 1e-12 of scale | PASS | PASS | +| NT-10 | A | Conductor strand slip, outer fibre: stick slope `R cos²α + (d/2) cos⁴α`, slip slope `(d/2) cos²α cos2α`, friction amplitude times `1 + (d/2) sin²α / R`; centroid parameters unchanged | 1e-13 | PASS | PASS | + ## Planned benchmarks None of these is a completed comparison. Each will be registered under the diff --git a/doc/citing.rst b/doc/citing.rst index 13cfba7..e4e7ca5 100644 --- a/doc/citing.rst +++ b/doc/citing.rst @@ -12,7 +12,7 @@ Software release ---------------- Seo, J. H. (2026). *CableXSec: Component-resolved local cross-section mechanics of dynamic -power cables* (version 0.2.0) [Computer software]. https://github.com/SMI-Lab-Inha/CableXSec +power cables* (version 0.2.1) [Computer software]. https://github.com/SMI-Lab-Inha/CableXSec .. code-block:: bibtex @@ -20,7 +20,7 @@ power cables* (version 0.2.0) [Computer software]. https://github.com/SMI-Lab-In author = {Seo, Jae Hoon}, title = {{CableXSec}: Component-resolved local cross-section mechanics of dynamic power cables}, - version = {0.2.0}, + version = {0.2.1}, year = {2026}, url = {https://github.com/SMI-Lab-Inha/CableXSec}, license = {Apache-2.0} diff --git a/doc/howto.md b/doc/howto.md index f41b6cf..921f204 100644 --- a/doc/howto.md +++ b/doc/howto.md @@ -149,16 +149,16 @@ tension and curvature, for a section stress map. ```text core state: frictional layer kind min MPa max MPa use limit -cu_conductor annulus -34.9 107.1 0.893 yielding +cu_conductor annulus -35.0 107.3 0.894 yielding conductor_screen annulus -0.2 0.3 - no limit given xlpe_insulation annulus -0.3 0.4 - no limit given insulation_screen annulus -0.3 0.4 - no limit given -cu_screen annulus -249.7 309.0 - follows the section +cu_screen annulus -250.0 310.7 - follows the section hdpe_core_sheath annulus -2.1 2.5 0.037 strain limit pp_filler annulus -7.0 7.6 - no limit given hdpe_bedding annulus -4.3 4.6 0.068 strain limit -inner_armour wires -71.4 152.2 0.221 yielding -outer_armour wires -25.7 97.8 0.142 yielding +inner_armour wires -71.9 152.7 0.221 yielding +outer_armour wires -25.7 98.0 0.142 yielding hdpe_outer_sheath annulus -5.5 5.9 0.086 strain limit inner_armour: 61 wires, centre line -38.9 to 119.7 MPa outer_armour: 67 wires, centre line 7.9 to 65.3 MPa @@ -218,8 +218,8 @@ all from one record. ```text armour: critical layer inner_armour, wire at 0 deg, fibre at 0 deg - inner_armour damage in 600 s 5.619e-05 - outer_armour damage in 600 s 2.468e-06 + inner_armour damage in 600 s 5.749e-05 + outer_armour damage in 600 s 2.509e-06 copper fibre: 122 cycles, max amplitude 1568 ue, damage 3.647e-05 curvature: mean 60 s maximum 0.0479 1/m, 1 h most probable 0.0761, 90 % fractile 0.0941 1/m inner_armour slip range 361.4 um, slipping share 0.56 diff --git a/doc/howto/figures/howto_04_section_stress.png b/doc/howto/figures/howto_04_section_stress.png index debf280..4d627a9 100644 Binary files a/doc/howto/figures/howto_04_section_stress.png and b/doc/howto/figures/howto_04_section_stress.png differ diff --git a/doc/howto/scripts/howto_04_section_stress.py b/doc/howto/scripts/howto_04_section_stress.py index c8922ea..b7e6521 100644 --- a/doc/howto/scripts/howto_04_section_stress.py +++ b/doc/howto/scripts/howto_04_section_stress.py @@ -16,7 +16,9 @@ import numpy as np import cablexsec as cx +from cablexsec.plotting.style import LABELS, SIGNED_CMAP, apply_style +apply_style() # the MATLAB-style figures of every CableXSec plot FIGURES = ( Path(sys.argv[1]) if len(sys.argv) > 1 @@ -62,15 +64,15 @@ xy[:, 1], c=layer.sigma_Pa.reshape(-1) / 1e6, s=4 if layer.kind != "wires" else 10, - cmap="coolwarm", + cmap=SIGNED_CMAP, vmin=-300, vmax=300, ) -fig.colorbar(marks, ax=ax, label="longitudinal stress [MPa]") +fig.colorbar(marks, ax=ax, label=r"Longitudinal stress $\sigma_{zz}$ [MPa]") ax.set_aspect("equal") -ax.set_xlabel("x [mm]") -ax.set_ylabel("y [mm]") -ax.set_title("T = 100 kN, curvature 0.1 1/m towards +y", fontsize=9) +ax.set_xlabel(LABELS["x_mm"]) +ax.set_ylabel(LABELS["y_mm"]) +ax.set_title(r"$T$ = 100 kN, $\kappa$ = 0.1 m$^{\mathrm{-1}}$ towards $+y$", fontsize=9) fig.tight_layout() FIGURES.mkdir(parents=True, exist_ok=True) -fig.savefig(FIGURES / "howto_04_section_stress.png", dpi=150) +fig.savefig(FIGURES / "howto_04_section_stress.png", dpi=200) diff --git a/doc/index.rst b/doc/index.rst index 47bc369..68f88a2 100644 --- a/doc/index.rst +++ b/doc/index.rst @@ -14,7 +14,7 @@ turns them into the fatigue damage of the armour, the conductor and the metallic .. admonition:: Release status :class: note - CableXSec ``v0.2.0`` is the current release. It is distributed as a source + CableXSec ``v0.2.1`` is the current release. It is distributed as a source repository and a pure-Python wheel on the `GitHub release page `_. Every comparison with published data, including the comparisons that do not meet their diff --git a/doc/installation.rst b/doc/installation.rst index ef9167e..4b567f7 100644 --- a/doc/installation.rst +++ b/doc/installation.rst @@ -9,21 +9,21 @@ is distributed through its GitHub repository; it is not published on a package i From a release -------------- -Download ``cablexsec-0.2.0-py3-none-any.whl`` and ``SHA256SUMS.txt`` from the -`v0.2.0 release `_, compare +Download ``cablexsec-0.2.1-py3-none-any.whl`` and ``SHA256SUMS.txt`` from the +`v0.2.1 release `_, compare the checksum, and install the wheel with its optional extras: .. code-block:: powershell - Get-FileHash cablexsec-0.2.0-py3-none-any.whl -Algorithm SHA256 - python -m pip install "cablexsec-0.2.0-py3-none-any.whl[fast]" + Get-FileHash cablexsec-0.2.1-py3-none-any.whl -Algorithm SHA256 + python -m pip install "cablexsec-0.2.1-py3-none-any.whl[fast]" From the repository ------------------- .. code-block:: powershell - python -m pip install "cablexsec[fast] @ git+https://github.com/SMI-Lab-Inha/CableXSec.git@v0.2.0" + python -m pip install "cablexsec[fast] @ git+https://github.com/SMI-Lab-Inha/CableXSec.git@v0.2.1" or, for development, clone the repository and install it in editable mode (see :doc:`development`): diff --git a/doc/local_analysis_guide.md b/doc/local_analysis_guide.md index 87d6904..146bbb2 100644 --- a/doc/local_analysis_guide.md +++ b/doc/local_analysis_guide.md @@ -552,6 +552,22 @@ rotating bending it can be constant while material points cycle. For direct control use `cx.compute_fatigue(cable, kx, ky, ...)` with one of `tension_N`, `axial_strain` or `section_states`. +**Local bending follows the slip state.** The normal (radial, weak-axis) +local bending of each wire is `E (t/2) [cos²α cos2α p_n + (sin²α / r) σ_f / E]` +with `p_n = κx cos φ + κy sin φ` and `σ_f` the friction stress the wire carries +at that sample (with any termination increment). The first term is the curve +curvature of the deformed helix (Out and von Morgen 1997, Eq. 41; Leroy and +Estrier 2001, Eq. 13); the second converts it to the rotation of the wire's +cross-section per unit material length, which is what bends the wire. A stuck +wire with the plane-section strain therefore takes `cos⁴α`, with the stick +coefficient `ξ` it takes `cos²α cos2α + ξ sin²α cos²α`, and a wire without +friction stress keeps `cos²α cos2α`. In Coulomb slip the slope stays +`cos²α cos2α`. The lateral term `cos α (1 + sin²α) p_l` does not depend on the +slip state. `radial_Pa` of `WireStressField` holds the sum, so every fibre +recovery and component stress concentration factor uses it. The stick and slip +limits were checked against an independent finite-element model of a wire on a +bent support (not published). + **Selected wire positions.** For long records at many cable locations, `cx.compute_fatigue(..., wire_positions=12)` evaluates 12 equally spaced wire positions per armour layer instead of every wire. A list of azimuths in degrees @@ -901,7 +917,9 @@ for state in response.states: states of Section 13.1: `sigma_stick_*` (core held to the cable axis, `"stuck"`), `sigma_frictional_*` (the core friction law of Section 6.1 in closed form for a monotonic ramp, default `CoreFrictionSpec()`, μ = 0.2 on - every core contact) and `sigma_local_*` (free core slip: each core bends + every core contact; with `core_core_coupling="relative"` the end of a + 400-increment proportional ramp, since the coupled stations redistribute + their stress) and `sigma_local_*` (free core slip: each core bends about its own axis). The stuck state holds only below the slip curvature of the cores; on the IEA 66 kV template the cores slip at about 3e-4 1/m, so at any practical curvature the frictional state is close to free slip. @@ -978,6 +996,32 @@ print(core.loads, core.xi, core.mu_effective, core.stick_EI_Nm2) cores use the same direction-tied Papailiou cap and return map as the armour wires, so biaxial histories work (`cablexsec.mechanics.core_friction.core_friction_history`). +- Core–core coupling (`CoreFrictionSpec(core_core_coupling=...)`). By default + (`"absolute"`) every contact of a core, its neighbours included, resists the + slip of that core against the plane section, as for a helix on a fixed + cylinder: full slip at `π/2` times the onset curvature. `"relative"` is a + coupled intralayer slip model of laid cores: neighbouring cores touch at + the same axial position, so the friction between them resists their + relative slip `u_i − u_j`, while the filler and ring contacts keep the + absolute slip. The stations of the cores at one axial position form a + group whose intralayer friction shares sum to zero; the intralayer share of + a station is bounded by `σ0 μ_cc (q_cc/q) |sin β| min(ψ, π/n)` (`ψ` from the + neutral axis), the interlayer share by the Papailiou cap with + `μ_a = (μ_cf q_cf + μ_cs q_cs)/q`, and the return map is the closest point + of the group (`cablexsec.mechanics.station_coupling`). With core–core + contact only (three cores) slip starts at the same onset, the largest + frozen friction stress is 2/3 and the full-slip moment `√3/2` of the + absolute values, and full slip comes at `2π/(3√3) = 1.209` times the onset. + An independent field solver of the coupled axial equilibrium of the three + cores (`validation/scripts/coupled_core_slip_reference.py`) gives the same + onset, full-slip curvature, moment–curvature, friction-force distribution + and reversal loop, with and without interlayer friction + (`tests/test_core_coupled_slip.py`). It is a direction-tied law: + `friction_model="distributed"` raises and `"auto"` keeps it on a non-planar + path with a `FrictionModelFallbackWarning`. The stick state, the contact + loads and the onset are those of the default. The default stays + `"absolute"`; the effect on the shipped cables is in + [template_66kv.md](template_66kv.md) Section 4.1. - Friction model of the cores and profiles, as for the armour: `core_friction_history(..., friction_model="distributed")` solves each population with the distributed helix model of the armour (the axial force @@ -1033,7 +1077,9 @@ print(core.loads, core.xi, core.mu_effective, core.stick_EI_Nm2) `export_bending_law(..., core_friction=...)`. The cores stick and carry their parallel-axis term until slip onset `μ q / (ξ EA_core sin β cos β)` (Skeie and Sødahl 2012, Eq. 2.31) and all slip from - `q expm1(μ sin β π/2) / (ξ EA_core sin² β cos β)` (Papailiou 1997, Eq. 15); + `q expm1(μ sin β π/2) / (ξ EA_core sin² β cos β)` (Papailiou 1997, Eq. 15; + with `core_core_coupling="relative"` the full-slip curvature of the coupled + stations, `core_full_slip_curvature`); both curvatures are reported per case and are nodes of the backbone grid. With `CoreFrictionSpec(core_shear=False, strand_slip=False)` the backbone starts on `compute_stiffness(cable).ei_max_Nm2`; with the core insulation @@ -1171,7 +1217,9 @@ tendon on the bent pipe and its transverse equilibrium: coefficients per unit pipe curvature for a transverse slip fraction `eta` of the geodesic offset `w_g = r² cos a (1 + sin² a) / sin² a` (Sævik 1992 Eq. 2.30). `eta = 0` is the loxodrome of the fatigue path (lateral - `cos a (1 + sin² a)`, normal `cos² a cos 2a`), `eta = 1` the geodesic + `cos a (1 + sin² a)`, normal `cos² a cos 2a` for a tendon without friction + stress; the stress recovery adds the term of the tendon's slip state, + Section 5, Step 2), `eta = 1` the geodesic (lateral 0, normal `3 cos² a`, Sævik 1992 Eq. 2.32, Out and von Morgen 1997 Eq. 39; checked against a numerical geodesic on the torus in `validation/scripts/check_out_von_morgen.py`). @@ -2262,7 +2310,10 @@ kin = cx.core_kinematics(cable, kx, ky, state="stuck") # axis strain, gradient ``` A cable axial strain adds `ε cos²β` to the core axis in every state. The -layers of a core are taken as bonded (they share `ε_c`). +layers of a core are taken as bonded (they share `ε_c`). The normal gradient +`g_r` follows the core slip state like the normal bending of an armour wire +(Section 5, Step 2): `g_r = cos²β cos2β κ_r + (sin²β / r_c) ε_b`, with `ε_b` the +bending part of `ε_c`, which is `cos⁴β κ_r` stuck and `cos²β cos2β κ_r` free. ### 13.2 Wire screens wound about each core (P1) diff --git a/doc/quickstart.rst b/doc/quickstart.rst index f886d0f..9dae1ac 100644 --- a/doc/quickstart.rst +++ b/doc/quickstart.rst @@ -33,8 +33,8 @@ The output is:: EA = 280 MN, EI full slip = 3571 N m^2, EI no slip = 189.8 kN m^2 peak moment 541 N m, friction work 218.0 J/m over the history - inner_armour: largest Miner damage 1.774e-06 over the record - outer_armour: largest Miner damage 3.005e-07 over the record + inner_armour: largest Miner damage 1.809e-06 over the record + outer_armour: largest Miner damage 3.050e-07 over the record Every result carries a ``provenance`` record that names the method, the cited sources, the verification gates and the limitations of the calculation; print ``fatigue.provenance`` to see diff --git a/doc/template_66kv.md b/doc/template_66kv.md index 770d705..ad21863 100644 --- a/doc/template_66kv.md +++ b/doc/template_66kv.md @@ -189,6 +189,13 @@ armour governs): | `direction_tied` (default) | 1.31e-9 | 7.88e-10 | | `distributed` | 1.30e-9 | 7.77e-10 | +Since the normal local bending of the wires follows their slip state +(CHANGELOG, Unreleased), the largest wire damage of this record (0.1 s +sampling, noise 4e-4 1/m) is 0.23–0.27 % higher for the inner armour and +0.05–0.06 % higher for the outer armour in all four columns, at the same +wire and fibre; the table keeps its earlier values, like the other +stick-dependent values above. + The two friction laws agree within 1 % on this smooth history. Core friction (Section 4.1) does not change these damages: the fatigue path is curvature driven, and the armour wire stresses do not depend on the cores. At 50 kN the @@ -258,6 +265,20 @@ What the comparison shows: Fig. 12b and Table 13), and no input is changed to follow either. - A synthetic 61-wire conductor (lay ratio 12, Table 2 copper friction 0.30) raises the half-height by a further 0.03 kN·m. +- **Core–core coupling.** With `CoreFrictionSpec(core_core_coupling="relative")` + (the coupled intralayer slip model of the local analysis guide, + Section 6.1) the friction between neighbouring cores acts on their relative + slip. At 50 kN with the default coefficients (0.2) the bounded trefoil puts + 67 % of the core contact load on the core–core contacts; the solved radial + state has no core–core contact force at that tension (98 % of the load is + on the filler), so the two options agree on it. On the bounded state the cores reach full slip at 1.22 instead of + 1.61 times their onset curvature, their full-slip friction moment is 9 % + lower and the range of the core-axis friction strain 22 % lower. The + section secant stiffness falls by 2.8, 2.5 and 2.1 % at 2, 5 and 10 times + the core onset (the stick value is unchanged), the cycle work at ±10 times + the onset by 2.4 %, and the exported backbone by 0.5 % at 0.04 1/m and + 0.1 % at 0.2 1/m. Armour and conductor damage are curvature driven and do + not change. ### 4.2 Energised cable: temperature history into clamping and fatigue diff --git a/doc/tutorials/03_global_to_fatigue.md b/doc/tutorials/03_global_to_fatigue.md index 2fdba9b..da4a0d9 100644 --- a/doc/tutorials/03_global_to_fatigue.md +++ b/doc/tutorials/03_global_to_fatigue.md @@ -188,8 +188,8 @@ gives `T_e − p_o A_o`, and use `fatigue_from_series`. ```text warnings: DirectionTiedFrictionWarning, MissingClampingStateWarning -inner_armour: 139 wires, damage 7.715e-09 to 1.383e-08, largest on wire 70 at 181.3 deg, fibre 180.00 deg -outer_armour: 145 wires, damage 7.428e-09 to 8.886e-09, largest on wire 73 at 181.2 deg, fibre 180.00 deg +inner_armour: 139 wires, damage 7.715e-09 to 1.382e-08, largest on wire 70 at 181.3 deg, fibre 180.00 deg +outer_armour: 145 wires, damage 7.429e-09 to 8.884e-09, largest on wire 73 at 181.2 deg, fibre 180.00 deg governing: inner_armour, wire at 181.3 deg, fibre 180.00 deg (bulk damage) ``` @@ -250,7 +250,7 @@ wire about its own axes. `at_fibre(angle)` combines them at any fibre. ```text inner_armour: same damage as compute_fatigue True, 1 Hz equivalent range 2.18 to 12.39 MPa -outer_armour: same damage as compute_fatigue True, 1 Hz equivalent range 2.11 to 11.10 MPa +outer_armour: same damage as compute_fatigue True, 1 Hz equivalent range 2.11 to 11.09 MPa ``` With the contact pressure history of `armour_contact_histories` and the @@ -272,10 +272,10 @@ local analysis guide, and the `count_from_sample` argument of ```text S-N curve saevik_2011_flat_steel: slope m = 4, [Saevik2011] Eq. (89) stress at the governing fibre: 16.1 to 48.8 MPa -rainflow: 153.0 cycles, largest range 32.74 MPa +rainflow: 153.0 cycles, largest range 32.73 MPa equivalent range over the counted cycles 17.44 MPa equivalent range at 1 Hz, 600 cycles 12.39 MPa -damage from the equivalent range 1.3829e-08, from compute_fatigue 1.3829e-08 +damage from the equivalent range 1.3816e-08, from compute_fatigue 1.3816e-08 ``` For an S–N curve of a single slope `m`, the damage-equivalent stress range diff --git a/doc/tutorials/04_contact_and_fretting.md b/doc/tutorials/04_contact_and_fretting.md index bc674da..abdf250 100644 --- a/doc/tutorials/04_contact_and_fretting.md +++ b/doc/tutorials/04_contact_and_fretting.md @@ -143,10 +143,10 @@ loading; they are not the stresses of the deformed contact. contact loads at 150 kN; extreme fibre of the dynamic bending at -4.0 deg inner_armour/outer_face on outer_armour: mu 0.12, load 209.7 N, p0 3112 MPa, transition amplitude 1.11 um largest slip amplitude 364 um; cycles in stick 0%, partial slip 16%, gross slip 84% - damage per year at the contact fibre 9.597 at 1 deg from the extreme fibre; largest wear at 88 deg + damage per year at the contact fibre 9.687 at 1 deg from the extreme fibre; largest wear at 88 deg outer_armour/inner_face on inner_armour: mu 0.12, load 209.7 N, p0 3112 MPa, transition amplitude 1.11 um largest slip amplitude 402 um; cycles in stick 0%, partial slip 15%, gross slip 85% - damage per year at the contact fibre 2.169 at 4 deg from the extreme fibre; largest wear at 88 deg + damage per year at the contact fibre 2.149 at 4 deg from the extreme fibre; largest wear at 88 deg outer_armour/outer_face: no normal load on this face ``` @@ -234,7 +234,7 @@ fretting life. Nor is it the {term}`Ruiz parameter` (Ruiz et al. 1984), which is formed from the local surface shear traction and slip and, in its second form, the local -tangential stress. CableXSec 0.2.0 does not compute Ruiz parameters. +tangential stress. CableXSec 0.2.1 does not compute Ruiz parameters. ## 8. The SWT critical plane next to a crossing @@ -254,18 +254,18 @@ strain histories. ```text -wire 109 (gross slip): largest bulk cycle 373.0 MPa about 106.9 MPa -SWT of the bulk cycle alone 0.2598 MPa +wire 109 (gross slip): largest bulk cycle 373.9 MPa about 107.1 MPa +SWT of the bulk cycle alone 0.2610 MPa x = +0.0 a, z = 0.5 b: SWT 0.0000 MPa -x = -1.0 a, z = 0.5 b: SWT 0.2911 MPa -x = -1.1 a, z = 0.5 b: SWT 0.3546 MPa -x = -1.1 a, z = 0.05 b: SWT 0.8058 MPa, plane normal 8 deg from the wire axis -x = -1.1 a, z = 0.10 b: SWT 0.7393 MPa, plane normal 8 deg from the wire axis -x = -1.1 a, z = 0.20 b: SWT 0.6116 MPa, plane normal 8 deg from the wire axis -x = -1.1 a, z = 0.30 b: SWT 0.5033 MPa, plane normal 8 deg from the wire axis -x = -1.1 a, z = 0.50 b: SWT 0.3546 MPa, plane normal 8 deg from the wire axis -x = -1.1 a, z = 0.75 b: SWT 0.2665 MPa, plane normal 10 deg from the wire axis -x = -1.1 a, z = 1.00 b: SWT 0.2345 MPa, plane normal 10 deg from the wire axis +x = -1.0 a, z = 0.5 b: SWT 0.2923 MPa +x = -1.1 a, z = 0.5 b: SWT 0.3560 MPa +x = -1.1 a, z = 0.05 b: SWT 0.8079 MPa, plane normal 8 deg from the wire axis +x = -1.1 a, z = 0.10 b: SWT 0.7413 MPa, plane normal 8 deg from the wire axis +x = -1.1 a, z = 0.20 b: SWT 0.6134 MPa, plane normal 8 deg from the wire axis +x = -1.1 a, z = 0.30 b: SWT 0.5049 MPa, plane normal 8 deg from the wire axis +x = -1.1 a, z = 0.50 b: SWT 0.3560 MPa, plane normal 8 deg from the wire axis +x = -1.1 a, z = 0.75 b: SWT 0.2677 MPa, plane normal 10 deg from the wire axis +x = -1.1 a, z = 1.00 b: SWT 0.2356 MPa, plane normal 10 deg from the wire axis ``` The script builds one cycle at the crossing of the inner-armour wire with the @@ -298,7 +298,7 @@ Points nearer the surface at the edge itself need a higher quadrature order. converge; it never returns an unconverged stress. `compute_swt_cycle` also returns a formal life from a strain-life law -(`SWTLifeConstants`). The SWT constants registered in CableXSec 0.2.0 +(`SWTLifeConstants`). The SWT constants registered in CableXSec 0.2.1 (`sn_curves.SWT_LIFE`) are those of copper, and none are for armour steel, so the script passes a placeholder law and prints no life. With constants from a source, `result.life_cycles` gives it. diff --git a/doc/tutorials/figures/tutorial_01_first_cable.png b/doc/tutorials/figures/tutorial_01_first_cable.png index 2600740..baa103c 100644 Binary files a/doc/tutorials/figures/tutorial_01_first_cable.png and b/doc/tutorials/figures/tutorial_01_first_cable.png differ diff --git a/doc/tutorials/figures/tutorial_02_measured_loop.png b/doc/tutorials/figures/tutorial_02_measured_loop.png index da9ad24..2b75fc7 100644 Binary files a/doc/tutorials/figures/tutorial_02_measured_loop.png and b/doc/tutorials/figures/tutorial_02_measured_loop.png differ diff --git a/doc/tutorials/figures/tutorial_02_sensitivity.png b/doc/tutorials/figures/tutorial_02_sensitivity.png index f2f8014..f0b0f86 100644 Binary files a/doc/tutorials/figures/tutorial_02_sensitivity.png and b/doc/tutorials/figures/tutorial_02_sensitivity.png differ diff --git a/doc/tutorials/figures/tutorial_03_damage_circumference.png b/doc/tutorials/figures/tutorial_03_damage_circumference.png index c1d9a9a..a3c0d74 100644 Binary files a/doc/tutorials/figures/tutorial_03_damage_circumference.png and b/doc/tutorials/figures/tutorial_03_damage_circumference.png differ diff --git a/doc/tutorials/figures/tutorial_03_governing_fibre_stress.png b/doc/tutorials/figures/tutorial_03_governing_fibre_stress.png index 9fcdd44..41b1145 100644 Binary files a/doc/tutorials/figures/tutorial_03_governing_fibre_stress.png and b/doc/tutorials/figures/tutorial_03_governing_fibre_stress.png differ diff --git a/doc/tutorials/figures/tutorial_04_slip_amplitude.png b/doc/tutorials/figures/tutorial_04_slip_amplitude.png index 1162bec..52e17e9 100644 Binary files a/doc/tutorials/figures/tutorial_04_slip_amplitude.png and b/doc/tutorials/figures/tutorial_04_slip_amplitude.png differ diff --git a/doc/tutorials/figures/tutorial_04_swt_depth.png b/doc/tutorials/figures/tutorial_04_swt_depth.png index b6044d0..deea462 100644 Binary files a/doc/tutorials/figures/tutorial_04_swt_depth.png and b/doc/tutorials/figures/tutorial_04_swt_depth.png differ diff --git a/doc/tutorials/scripts/tutorial_01_first_cable.py b/doc/tutorials/scripts/tutorial_01_first_cable.py index 0687255..7401c30 100644 --- a/doc/tutorials/scripts/tutorial_01_first_cable.py +++ b/doc/tutorials/scripts/tutorial_01_first_cable.py @@ -23,7 +23,9 @@ slip_onset_curvature, ) from cablexsec.mechanics.radial_cable import solve_cable_radial_states +from cablexsec.plotting.style import COLORS, LABELS, apply_style +apply_style() # the MATLAB-style figures of every CableXSec plot FIGURES = ( Path(sys.argv[1]) if len(sys.argv) > 1 @@ -97,33 +99,49 @@ radial = solve_cable_radial_states(cable, sweep) fig, (ax_contact, ax_bending) = plt.subplots(1, 2, figsize=(9.0, 3.8)) for i, (layer, colour) in enumerate( - zip(cable.helical_layers, ("C0", "C1"), strict=True) + zip(cable.helical_layers, (COLORS["BLUE"], COLORS["ORANGE"]), strict=True) ): p_bounded = [specs[i].contact_pressure_Pa / 1e6 for specs in bounded] p_solved = [s.armour_contact_pressure()[layer.name] / 1e6 for s in radial] - ax_contact.plot(sweep / 1e3, p_bounded, "-", c=colour, label=f"{layer.name}") + label = layer.name.replace("_", " ") + ax_contact.plot(sweep / 1e3, p_bounded, "-", c=colour, label=label) ax_contact.plot(sweep / 1e3, p_solved, "--", c=colour) -ax_contact.set_xlabel("tension [kN]") -ax_contact.set_ylabel("armour contact pressure P1 + P2 [MPa]") +ax_contact.set_xlabel(LABELS["tension_kN"]) +ax_contact.set_ylabel(r"Armour contact pressure $P_\mathrm{1} + P_\mathrm{2}$ [MPa]") ax_contact.set_title("Solid: bounded chain; dashed: solved") ax_contact.legend(loc="upper left") kappa = np.linspace(0.0, 0.02, 401) -for tension, colour in ((0.0, "black"), (100e3, "tab:red")): +for tension, colour in ((0.0, COLORS["BLUE"]), (100e3, COLORS["ORANGE"])): loop = cx.compute_mkappa(cable, kappa, tension_N=tension) ax_bending.plot( - kappa, loop.moment_Nm, color=colour, label=f"T = {tension / 1e3:.0f} kN" + kappa, loop.moment_Nm, color=colour, label=rf"$T$ = {tension / 1e3:.0f} kN" ) for spec in cx.cable_to_mkappa_specs(cable, tension, contact_model="bounded"): onset = slip_onset_curvature(spec) ax_bending.plot(onset, np.interp(onset, kappa, loop.moment_Nm), "o", c=colour) -ax_bending.plot(kappa, stiffness.ei_min_Nm2 * kappa, "--", c="grey", label="full slip") -ax_bending.plot(kappa, stiffness.ei_max_Nm2 * kappa, ":", c="grey", label="no slip") +ax_bending.plot( + kappa, + stiffness.ei_min_Nm2 * kappa, + "--", + c=COLORS["GREY"], + lw=1.0, + label=r"full slip, $EI_\mathrm{min}$", +) +ax_bending.plot( + kappa, + stiffness.ei_max_Nm2 * kappa, + ":", + c=COLORS["GREY"], + lw=1.0, + label=r"no slip, $EI_\mathrm{max}$", +) ax_bending.set_ylim(0.0, 700.0) -ax_bending.set_xlabel("curvature [1/m]") -ax_bending.set_ylabel("bending moment [N m]") +ax_bending.set_xticks(np.linspace(0.0, 0.02, 5)) +ax_bending.set_xlabel(LABELS["curvature"]) +ax_bending.set_ylabel(LABELS["moment_Nm"]) ax_bending.set_title("First loading; dots: slip onset") ax_bending.legend(loc="lower right") fig.tight_layout() FIGURES.mkdir(parents=True, exist_ok=True) -fig.savefig(FIGURES / "tutorial_01_first_cable.png", dpi=150) +fig.savefig(FIGURES / "tutorial_01_first_cable.png", dpi=200) print(f"wrote {(FIGURES / 'tutorial_01_first_cable.png').name}") diff --git a/doc/tutorials/scripts/tutorial_02_bending_hysteresis.py b/doc/tutorials/scripts/tutorial_02_bending_hysteresis.py index ed3945e..4cb98b6 100644 --- a/doc/tutorials/scripts/tutorial_02_bending_hysteresis.py +++ b/doc/tutorials/scripts/tutorial_02_bending_hysteresis.py @@ -22,7 +22,9 @@ import cablexsec as cx from cablexsec.analysis.curve_comparison import cycle_work, insert_cycle_crossings from cablexsec.mechanics.papailiou import slip_onset_curvature +from cablexsec.plotting.style import COLORS, LABELS, apply_style +apply_style() # the MATLAB-style figures of every CableXSec plot REPOSITORY = Path(__file__).resolve().parents[3] MEASURED = REPOSITORY / "validation" / "paper_data" / "menard_fig16b_ordered.csv" FIGURES = ( @@ -97,30 +99,39 @@ def describe(label, result, spec): # [step-figures] FIGURES.mkdir(parents=True, exist_ok=True) fig, ax = plt.subplots(figsize=(5.0, 4.0)) -ax.plot(kappa_test, moment_test, "o", ms=3, mfc="none", c="grey", label="measured") -ax.plot(path, loop.moment_Nm[second], c="black", label="CableXSec") -ax.set_xlabel("curvature [1/m]") +ax.plot( + kappa_test, + moment_test, + "o", + ms=3, + mfc="none", + c=COLORS["BLACK"], + mew=0.6, + label="measured", +) +ax.plot(path, loop.moment_Nm[second], c=COLORS["BLUE"], label="CableXSec") +ax.set_xlabel(LABELS["curvature"]) ax.set_xticks([-0.1, -0.05, 0.0, 0.05, 0.1]) -ax.set_ylabel("bending moment [N m]") +ax.set_ylabel(LABELS["moment_Nm"]) ax.set_title("Ménard and Cartraud (2023), range (b)") ax.legend(loc="upper left") fig.tight_layout() -fig.savefig(FIGURES / "tutorial_02_measured_loop.png", dpi=150) +fig.savefig(FIGURES / "tutorial_02_measured_loop.png", dpi=200) print(f"wrote {(FIGURES / 'tutorial_02_measured_loop.png').name}") fig, (ax_mu, ax_p) = plt.subplots(1, 2, figsize=(9.0, 3.8), sharey=True) for mu, result in friction_loops.items(): - ax_mu.plot(kappa[cycle], result.moment_Nm[cycle], label=f"mu = {mu}") + ax_mu.plot(kappa[cycle], result.moment_Nm[cycle], label=rf"$\mu$ = {mu}") for pressure, result in clamping_loops.items(): - label = f"p0 = {pressure / 1e6:.2f} MPa" + label = rf"$p_\mathrm{{0}}$ = {pressure / 1e6:.2f} MPa" ax_p.plot(kappa[cycle], result.moment_Nm[cycle], label=label) -ax_mu.set_title("Friction coefficient (p0 = 0.30 MPa)") -ax_p.set_title("Initial pressure p0 (mu = 0.2)") -ax_mu.set_ylabel("bending moment [N m]") +ax_mu.set_title(r"Friction coefficient ($p_\mathrm{0}$ = 0.30 MPa)") +ax_p.set_title(r"Initial pressure $p_\mathrm{0}$ ($\mu$ = 0.2)") +ax_mu.set_ylabel(LABELS["moment_Nm"]) for axis in (ax_mu, ax_p): - axis.set_xlabel("curvature [1/m]") + axis.set_xlabel(LABELS["curvature"]) axis.set_xticks([-0.1, -0.05, 0.0, 0.05, 0.1]) axis.legend(loc="upper left") fig.tight_layout() -fig.savefig(FIGURES / "tutorial_02_sensitivity.png", dpi=150) +fig.savefig(FIGURES / "tutorial_02_sensitivity.png", dpi=200) print(f"wrote {(FIGURES / 'tutorial_02_sensitivity.png').name}") diff --git a/doc/tutorials/scripts/tutorial_03_global_to_fatigue.py b/doc/tutorials/scripts/tutorial_03_global_to_fatigue.py index 46e05d4..f2f6187 100644 --- a/doc/tutorials/scripts/tutorial_03_global_to_fatigue.py +++ b/doc/tutorials/scripts/tutorial_03_global_to_fatigue.py @@ -27,7 +27,9 @@ from cablexsec.analysis.fast_rainflow import fibre_fatigue from cablexsec.analysis.fatigue import rainflow_cycles, wire_stress_field from cablexsec.cable_adapters import cable_to_fatigue_layers +from cablexsec.plotting.style import COLORS, LABELS, apply_style +apply_style() # the MATLAB-style figures of every CableXSec plot REPOSITORY = Path(__file__).resolve().parents[3] FIGURES = ( Path(sys.argv[1]) @@ -208,29 +210,34 @@ for name, damage in fatigue.D_total_per_wire.items(): count = damage.size ax.plot(360.0 * np.arange(count) / count, damage, label=name.replace("_", " ")) -ax.axvline(fatigue.phi_critical_deg, color="0.5", linewidth=0.8, linestyle="--") -ax.set_xlabel("wire azimuth from e1 [deg]") -ax.set_ylabel("Miner damage over the record") +ax.axvline( + fatigue.phi_critical_deg, color=COLORS["GREY"], linewidth=1.0, linestyle="--" +) +ax.set_xlabel(r"Wire azimuth from $\mathbf{e}_\mathrm{1}$, $\varphi$ [$^\circ$]") +ax.set_ylabel(r"Miner damage over the record, $D$ [–]") ax.set_xlim(0.0, 360.0) ax.set_xticks(np.arange(0, 361, 45)) ax.set_ylim(bottom=0.0) ax.ticklabel_format(axis="y", style="sci", scilimits=(0, 0)) -ax.legend(frameon=False, loc="lower center") -fig.savefig(FIGURES / "tutorial_03_damage_circumference.png", dpi=150) +ax.legend(loc="lower center") +fig.savefig(FIGURES / "tutorial_03_damage_circumference.png", dpi=200) plt.close(fig) print("wrote tutorial_03_damage_circumference.png") fig, ax = plt.subplots(figsize=(6.4, 3.0), layout="constrained") window = series.time_s <= 120.0 -ax.plot(series.time_s[window], stress[window] / 1e6, linewidth=0.9) -ax.set_xlabel("time [s]") -ax.set_ylabel("fibre stress [MPa]") +ax.plot( + series.time_s[window], stress[window] / 1e6, color=COLORS["BLUE"], linewidth=1.0 +) +ax.set_xlabel(LABELS["time"]) +ax.set_ylabel(r"Fibre stress $\sigma$ [MPa]") ax.set_xlim(0.0, 120.0) ax.set_title( - f"{fatigue.critical_layer.replace('_', ' ')}, wire at " - f"{fatigue.phi_critical_deg:.0f} deg, fibre {fatigue.fibre_critical_deg:.0f} deg", + rf"{fatigue.critical_layer.replace('_', ' ')}, wire at " + rf"{fatigue.phi_critical_deg:.0f}$^\circ$, " + rf"fibre {fatigue.fibre_critical_deg:.0f}$^\circ$", fontsize=10, ) -fig.savefig(FIGURES / "tutorial_03_governing_fibre_stress.png", dpi=150) +fig.savefig(FIGURES / "tutorial_03_governing_fibre_stress.png", dpi=200) plt.close(fig) print("wrote tutorial_03_governing_fibre_stress.png") diff --git a/doc/tutorials/scripts/tutorial_04_contact_and_fretting.py b/doc/tutorials/scripts/tutorial_04_contact_and_fretting.py index bd23786..96b4f25 100644 --- a/doc/tutorials/scripts/tutorial_04_contact_and_fretting.py +++ b/doc/tutorials/scripts/tutorial_04_contact_and_fretting.py @@ -33,6 +33,7 @@ reduced_shear_modulus, solve_contact, ) +from cablexsec.plotting.style import COLORS, LABELS, apply_style FIGURES = ( Path(sys.argv[1]) @@ -274,8 +275,12 @@ def contact_cycle(x_over_a, z_over_b): f"plane normal {tilt:.0f} deg from the wire axis" ) # [step-figures] +apply_style() # the MATLAB-style figures of every CableXSec plot fig, ax = plt.subplots(figsize=(6.4, 4.0), layout="constrained") -for name, colour in (("inner_armour", "C0"), ("outer_armour", "C1")): +for name, colour in ( + ("inner_armour", COLORS["BLUE"]), + ("outer_armour", COLORS["ORANGE"]), +): face_name = faces[name] full = fretting.faces[face_name] label = name.replace("_", " ") @@ -288,24 +293,36 @@ def contact_cycle(x_over_a, z_over_b): ) stations, amplitude = friction_slip[name] ax.plot(stations, amplitude * 1e6, color=colour, label=f"{label}, friction law") -ax.set_xlabel("wire azimuth from e1 [deg]") -ax.set_ylabel("slip amplitude [µm]") +ax.set_xlabel(r"Wire azimuth from $\mathbf{e}_\mathrm{1}$, $\varphi$ [$^\circ$]") +ax.set_ylabel(LABELS["slip_um"]) ax.set_xlim(0.0, 360.0) ax.set_xticks(np.arange(0, 361, 45)) ax.set_ylim(bottom=0.0) -fig.legend(frameon=False, fontsize=8, ncols=2, loc="outside lower center") -fig.savefig(FIGURES / "tutorial_04_slip_amplitude.png", dpi=150) +fig.legend(fontsize=8, ncols=2, loc="outside lower center") +fig.savefig(FIGURES / "tutorial_04_slip_amplitude.png", dpi=200) plt.close(fig) print("wrote tutorial_04_slip_amplitude.png") fig, ax = plt.subplots(figsize=(6.4, 3.2), layout="constrained") -ax.plot(depths, np.array(profile) / 1e6, marker="o", label="next to the crossing") -ax.axhline(bulk_only / 1e6, color="0.4", linestyle="--", label="bulk cycle alone") -ax.set_xlabel("depth z / b at x = -1.1 a") -ax.set_ylabel("SWT indicator [MPa]") +ax.plot( + depths, + np.array(profile) / 1e6, + marker="o", + color=COLORS["BLUE"], + label="next to the crossing", +) +ax.axhline( + bulk_only / 1e6, + color=COLORS["GREY"], + linestyle="--", + linewidth=1.0, + label="bulk cycle alone", +) +ax.set_xlabel(r"Depth $z/b$ at $x = -1.1\,a$ [–]") +ax.set_ylabel(r"SWT indicator $\sigma_\mathrm{max}\,\varepsilon_\mathrm{a}$ [MPa]") ax.set_xlim(0.0, 1.05) ax.set_ylim(bottom=0.0) -ax.legend(frameon=False) -fig.savefig(FIGURES / "tutorial_04_swt_depth.png", dpi=150) +ax.legend() +fig.savefig(FIGURES / "tutorial_04_swt_depth.png", dpi=200) plt.close(fig) print("wrote tutorial_04_swt_depth.png") diff --git a/doc/user_guide.md b/doc/user_guide.md index 9049349..ade19c4 100644 --- a/doc/user_guide.md +++ b/doc/user_guide.md @@ -146,6 +146,29 @@ for screening. `cablexsec.plotting.build_dashboard` writes a standalone HTML viewer of stress, moment–curvature, capacity and fatigue results. +### 2.8 Figures + +`cablexsec.plotting` draws the standard figures from result objects: + +- `plot_mkappa` and `plot_mkappa_validation_suite`: moment–curvature loops; +- `plot_cross_section`: the section, by material or coloured by a stress component; +- `plot_stress_distribution` and `plot_stress_timeseries`: per-wire stress; +- `plot_damage_split` and `plot_fretting_polar`: fatigue; +- `plot_capacity_envelope` and `plot_temperature_gradient`: capacity and temperature. + +Every figure uses one MATLAB-style look (`cablexsec.plotting.style`): + +- MATLAB's default line colours, in MATLAB's order (`MATLAB_ORDER`; named in `COLORS`); +- a Helvetica or Arial face; +- a closed box with inward ticks and no grid; +- symbols with true Greek letters and sub- and superscripts, such as κ, EI_min and m⁻¹. + +`style.LABELS` holds the standard axis labels, for example +`LABELS["curvature"]` and `LABELS["moment_kNm"]`. Use them in your own scripts +too. Apply the look to your own figures with `style.apply_style()`, or for +one block with `with style.use_style():`. The limitations of a result are +printed on its figure verbatim. + ## 3. Reading results - **{term}`Provenance `.** Every result keeps its `provenance`: method, citations, diff --git a/examples/demo_02_mkappa_validation.py b/examples/demo_02_mkappa_validation.py index 95c97da..e8ce7e6 100644 --- a/examples/demo_02_mkappa_validation.py +++ b/examples/demo_02_mkappa_validation.py @@ -16,7 +16,7 @@ from _console import configure_console import cablexsec as cx -from cablexsec.plotting.style import COLORS, apply_style +from cablexsec.plotting.style import COLORS, LABELS, apply_style configure_console() @@ -48,10 +48,10 @@ def main() -> None: apply_style() fig, ax = plt.subplots(figsize=(5, 4)) - ax.plot(mk.kappa_1_m * 1e3, mk.moment_Nm, color=COLORS["BLACK"], label="CableXSec") - ax.set_xlabel(r"curvature $\kappa$ [$10^{-3}$ m$^{-1}$]") - ax.set_ylabel("moment [N·m]") - ax.set_title("Ménard cable — M–κ loop (EI_min comparison, A11)") + ax.plot(mk.kappa_1_m * 1e3, mk.moment_Nm, color=COLORS["BLUE"], label="CableXSec") + ax.set_xlabel(LABELS["curvature_milli"]) + ax.set_ylabel(LABELS["moment_Nm"]) + ax.set_title(r"Ménard cable — $M$–$\kappa$ loop ($EI_\mathrm{min}$ check, A11)") ax.legend() fig.savefig(OUT / "demo_02_mkappa.png") print(f"saved {OUT / 'demo_02_mkappa.png'}") diff --git a/examples/demo_03_stress_distribution.py b/examples/demo_03_stress_distribution.py index 6b61ff9..898ff76 100644 --- a/examples/demo_03_stress_distribution.py +++ b/examples/demo_03_stress_distribution.py @@ -15,7 +15,7 @@ from _console import configure_console import cablexsec as cx -from cablexsec.plotting.style import COLORS, apply_style +from cablexsec.plotting.style import COLORS, LABELS, apply_style configure_console() @@ -51,14 +51,14 @@ def main() -> None: phi = sr.phi_deg[name] fig, ax = plt.subplots(figsize=(6, 4)) for comp, col, lab in [ - (sr.sigma_A_Pa, COLORS["GREEN"], r"$\sigma_A$"), - (sr.sigma_B_Pa, COLORS["BLUE"], r"$\sigma_B$"), - (sr.sigma_f_Pa, COLORS["ORANGE"], r"$\sigma_f$"), - (sr.sigma_total_Pa, COLORS["BLACK"], r"$\sigma_{total}$"), + (sr.sigma_A_Pa, COLORS["BLUE"], r"$\sigma_\mathrm{A}$"), + (sr.sigma_B_Pa, COLORS["ORANGE"], r"$\sigma_\mathrm{B}$"), + (sr.sigma_f_Pa, COLORS["YELLOW"], r"$\sigma_\mathrm{f}$"), + (sr.sigma_total_Pa, COLORS["PURPLE"], r"$\sigma_\mathrm{total}$"), ]: ax.plot(phi, comp[name] / mpa, color=col, label=lab) - ax.set_xlabel(r"wire azimuth $\varphi$ [deg]") - ax.set_ylabel("stress [MPa]") + ax.set_xlabel(LABELS["azimuth"]) + ax.set_ylabel(LABELS["stress"]) ax.set_title(f"Per-wire stress — {name} (analytically verified)") ax.legend(ncol=2) fig.savefig(OUT / "demo_03_stress_distribution.png") diff --git a/examples/demo_05_fatigue_damage.py b/examples/demo_05_fatigue_damage.py index 6bd175f..4edeaed 100644 --- a/examples/demo_05_fatigue_damage.py +++ b/examples/demo_05_fatigue_damage.py @@ -16,7 +16,7 @@ from _console import configure_console import cablexsec as cx -from cablexsec.plotting.style import COLORS, apply_style +from cablexsec.plotting.style import COLORS, LABELS, apply_style configure_console() @@ -58,11 +58,11 @@ def main() -> None: phi, fat.D_bulk_per_wire[crit], width=360 / n, - color=COLORS["BLACK"], - label="D_bulk", + color=COLORS["BLUE"], + label=r"$D_\mathrm{bulk}$", ) - ax.set_xlabel(r"wire azimuth $\varphi$ [deg]") - ax.set_ylabel("Miner damage (history)") + ax.set_xlabel(LABELS["azimuth"]) + ax.set_ylabel(r"Miner damage over the history, $D$ [–]") ax.set_title(f"Fatigue damage per wire — {crit}") ax.legend() fig.savefig(OUT / "demo_05_fatigue_damage.png") diff --git a/examples/rig_test_gauge_plan.py b/examples/rig_test_gauge_plan.py index d5bf201..8913b0e 100644 --- a/examples/rig_test_gauge_plan.py +++ b/examples/rig_test_gauge_plan.py @@ -21,7 +21,7 @@ from _console import configure_console import cablexsec as cx -from cablexsec.plotting.style import apply_style +from cablexsec.plotting.style import LABELS, apply_style configure_console() @@ -69,20 +69,23 @@ def main() -> None: axes[0].plot( res.time_s, g.total, - label=f"{g.location.layer} {g.angle_deg:.0f} deg, x={g.location.x_m:.2f} m", + label=( + f"{g.location.layer.replace('_', ' ')} {g.angle_deg:.0f}$^\\circ$, " + f"$x$ = {g.location.x_m:.2f} m" + ), ) - axes[0].set_xlabel("time [s]") - axes[0].set_ylabel("wire strain [microstrain]") + axes[0].set_xlabel(LABELS["time"]) + axes[0].set_ylabel(r"Wire strain $\varepsilon$ [$\mu\varepsilon$]") axes[0].legend(fontsize=7) for station in res.stations: r = res.retained axes[1].plot( station.kappa_1_m[r], station.moment_Nm[r] / 1e3, - label=f"x = {station.x_m:.1f} m", + label=f"$x$ = {station.x_m:.1f} m", ) - axes[1].set_xlabel("curvature [1/m]") - axes[1].set_ylabel("moment [kN m]") + axes[1].set_xlabel(LABELS["curvature"]) + axes[1].set_ylabel(LABELS["moment_kNm"]) axes[1].legend() fig.tight_layout() path = OUT / "rig_test_gauge_plan.png" diff --git a/pyproject.toml b/pyproject.toml index ce9319c..eab228c 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -11,7 +11,7 @@ build-backend = "setuptools.build_meta" [project] name = "cablexsec" -version = "0.2.0" +version = "0.2.1" description = "Component-resolved local cross-section mechanics and fatigue of dynamic power cables" readme = "README.md" requires-python = ">=3.11,<3.13" diff --git a/src/cablexsec/__init__.py b/src/cablexsec/__init__.py index 9ec9561..9253f34 100644 --- a/src/cablexsec/__init__.py +++ b/src/cablexsec/__init__.py @@ -320,7 +320,7 @@ UnmodelledPolymerSofteningWarning, ) -__version__ = "0.2.0" +__version__ = "0.2.1" from cablexsec.project import ( # noqa: E402 PROJECT_FORMAT_VERSION, diff --git a/src/cablexsec/analysis/bending_law.py b/src/cablexsec/analysis/bending_law.py index d075006..6b55a0f 100644 --- a/src/cablexsec/analysis/bending_law.py +++ b/src/cablexsec/analysis/bending_law.py @@ -1549,8 +1549,16 @@ def _state_law( def _group_caps(law: _MkappaLaw) -> FloatArray: """Planar full-slip friction moment of every friction group [N m].""" values = [_friction_cap(spec) for spec in law.layers] - if law.core_model is not None: - values += [_friction_cap(spec) for spec in law.core_model.populations] + model = law.core_model + if model is not None: + from cablexsec.mechanics.core_friction import ( # noqa: PLC0415 + core_full_slip_moment, + ) + + # The cores hold the bounds of their own law (relative coupling: the + # interlayer plus the intralayer bound), the profiles the Papailiou cap. + values.append(core_full_slip_moment(model)) + values += [_friction_cap(spec) for spec in model.populations[1:]] return np.asarray(values, dtype=np.float64) @@ -1601,14 +1609,26 @@ def _slip_transitions( if law.progressive is not None and law.progressive.density == "uniform": n = law.progressive.n_elements spread = 1.0 - law.progressive.spread * (1.0 - 1.0 / n) - specs = [(spec, spread) for spec in law.layers] - if law.core_model is not None: - specs += [(spec, 1.0) for spec in law.core_model.populations] + specs: list[tuple[HelicalLayerSpec, float, float | None]] = [ + (spec, spread, None) for spec in law.layers + ] + model = law.core_model + if model is not None: + from cablexsec.mechanics.core_friction import ( # noqa: PLC0415 + core_full_slip_curvature, + ) + + # The coupled stations of the relative core law have their own + # full-slip curvature (core_full_slip_curvature). + core_full = None if model.coupling is None else core_full_slip_curvature(model) + specs += [(model.population, 1.0, core_full)] + specs += [(spec, 1.0, None) for spec in model.populations[1:]] out = [] - for spec, factor in specs: + for spec, factor, full in specs: if friction_law is not None and friction_law.pressure_dependent: scale = float(friction_law.pressure_factor_at(spec.contact_pressure_Pa)) spec = dataclasses.replace(spec, mu=spec.mu * scale) + full = None if full is None else full * scale onset = slip_onset_curvature(spec) if not (math.isfinite(onset) and onset > 0.0): continue # no friction: the group is in full slip from zero @@ -1618,7 +1638,7 @@ def _slip_transitions( tension, onset * _compression_onset_factor(lam) * factor, onset, - full_slip_curvature(spec), + full_slip_curvature(spec) if full is None else full, ) ) return out diff --git a/src/cablexsec/analysis/capacity.py b/src/cablexsec/analysis/capacity.py index 6864f85..07f77bf 100644 --- a/src/cablexsec/analysis/capacity.py +++ b/src/cablexsec/analysis/capacity.py @@ -137,7 +137,10 @@ from cablexsec.mechanics.papailiou import wire_slip_stress_bounds from cablexsec.mechanics.section_state import SectionState, solve_section_state from cablexsec.mechanics.stiffness import ea_fixed -from cablexsec.mechanics.wire_stress import local_bending_amplitude +from cablexsec.mechanics.wire_stress import ( + local_bending_amplitude, + slip_state_normal_curvature, +) from cablexsec.provenance import Provenance @@ -308,6 +311,8 @@ def _local_bending_max( e_w: float, lay_angle_rad: float, phi_bend: float, + friction_stress_Pa: NDArray[np.float64] | None = None, + r_helix_m: float | None = None, ) -> NDArray[np.float64]: """Largest local bending stress over the wire section [Pa]. @@ -315,18 +320,38 @@ def _local_bending_max( wires (gap G1): the normal curvature at the outer face ``t/2`` and the lateral curvature at the edge ``b/2`` combined at the corner (:meth:`~cablexsec.mechanics.tendon_section.WireSection.max_bending_stress`). + A given friction stress (with the helix radius) adds the normal curvature + of each wire's slip state + (:func:`~cablexsec.mechanics.wire_stress.slip_state_normal_curvature`); + without it the normal term is the slip limit ``cos^2 a cos 2a``. """ assert layer.d_wire_m is not None if layer.wire_shape == "round": return np.asarray( local_bending_amplitude( - kappa, phi, e_w, layer.d_wire_m, lay_angle_rad, phi_bend + kappa, + phi, + e_w, + layer.d_wire_m, + lay_angle_rad, + phi_bend, + friction_stress_Pa=friction_stress_Pa, + r_helix_m=r_helix_m, ) ) section = layer.wire_section angle = np.asarray(phi, dtype=np.float64) - phi_bend c, s = math.cos(lay_angle_rad), math.sin(lay_angle_rad) - face = e_w * abs(kappa) * c * c * math.cos(2 * lay_angle_rad) * np.cos(angle) + if friction_stress_Pa is None: + face = e_w * abs(kappa) * c * c * math.cos(2 * lay_angle_rad) * np.cos(angle) + else: + assert r_helix_m is not None + face = e_w * ( + kappa * c * c * math.cos(2 * lay_angle_rad) * np.cos(angle) + + slip_state_normal_curvature( + friction_stress_Pa, e_w, lay_angle_rad, r_helix_m + ) + ) edge = e_w * abs(kappa) * c * (1 + s * s) * np.sin(angle) return section.max_bending_stress( face * section.half_thickness_m, edge * section.half_width_m @@ -685,7 +710,14 @@ def maximum_usage(kappa: float) -> float: sigma_slip = np.where(cos_phi >= 0.0, cap_hi, cap_lo) sigma_friction = np.sign(cos_phi) * np.minimum(sigma_stick, sigma_slip) sigma_bending = _local_bending_max( - layer, kappa, phi, spec.E_wire_Pa, spec.lay_angle_rad, phi_bend + layer, + kappa, + phi, + spec.E_wire_Pa, + spec.lay_angle_rad, + phi_bend, + friction_stress_Pa=sigma_friction, + r_helix_m=spec.r_helix_m, ) sigma_total = ( np.abs(sigma_axial + sigma_friction + sigma_T_Pa) + sigma_bending diff --git a/src/cablexsec/analysis/components.py b/src/cablexsec/analysis/components.py index 56a6d4b..67efc98 100644 --- a/src/cablexsec/analysis/components.py +++ b/src/cablexsec/analysis/components.py @@ -97,7 +97,11 @@ ) from cablexsec.exceptions import CableInputError, CableSchemaError from cablexsec.materials import library -from cablexsec.mechanics.core_friction import CoreFrictionSpec, build_core_friction +from cablexsec.mechanics.core_friction import ( + CoreFrictionSpec, + build_core_friction, + core_station_history, +) from cablexsec.mechanics.core_kinematics import CORE_SLIP_STATES, CoreSlipState from cablexsec.mechanics.core_lay import core_angle, core_bending_components from cablexsec.mechanics.papailiou import wire_slip_stress_bounds @@ -110,7 +114,10 @@ from cablexsec.mechanics.shell_bending import shell_wall_stress from cablexsec.mechanics.stiffness import axial_stiffness_by_layer from cablexsec.mechanics.thermal import ThermalResult -from cablexsec.mechanics.wire_stress import local_bending_amplitude +from cablexsec.mechanics.wire_stress import ( + local_bending_amplitude, + slip_state_normal_curvature, +) from cablexsec.provenance import Provenance, require_finite __all__ = [ @@ -133,6 +140,10 @@ ) """How the stress of a layer outside the load path is obtained, in words.""" +#: Increments of the proportional path of the coupled (relative) core law in +#: the frictional core state of one section. +_COUPLED_RAMP_SAMPLES = 400 + _STATE_WORDS = { "stuck": "stuck (cores held to the cable axis)", "frictional": "frictional core slip", @@ -410,6 +421,22 @@ def _axial_stiffnesses(cable: CableData) -> dict[str, float]: return axial_stiffness_by_layer(cable) +def _core_slip_curvature( + beta: float, r_c: float, axis_strain: float | np.ndarray +) -> np.ndarray: + """Normal curvature of a laid core's slip state [1/m]. + + ``(sin^2(beta) / r_c) epsilon_b`` of the bending part ``epsilon_b`` of + the core-axis strain + (:func:`~cablexsec.mechanics.wire_stress.slip_state_normal_curvature`): + the core's normal curvature is ``cos^4(beta)`` per unit projected cable + curvature when stuck and ``cos^2(beta) cos(2 beta)`` when free. + """ + if r_c <= 0.0: + return np.zeros_like(np.asarray(axis_strain, dtype=np.float64)) + return slip_state_normal_curvature(axis_strain, 1.0, beta, r_c) + + @dataclass(frozen=True) class _CoreAxis: """Bending part of the core-axis strain of each core, per slip state. @@ -478,6 +505,25 @@ def _core_axis( if kappa == 0.0: frictional = np.zeros(layer.n_cores) slipping = 0 + elif model.coupling is not None: + # Relative core-core coupling: the stations of one axial position + # redistribute their stress, so the monotonic state is the end of a + # proportional path from the stress-free state. + stations = np.arange(layer.n_cores) * model.spec.n_stations_per_core + ramp = np.linspace(0.0, 1.0, _COUPLED_RAMP_SAMPLES + 1)[1:] + history = core_station_history( + model, + ramp * kappa_x, + ramp * kappa_y, + initial_bending_angle=math.atan2(kappa_y, kappa_x), + ) + stress = np.asarray(history.stress_Pa)[stations, -1] + frictional = stress / population.E_wire_Pa + cosine = np.cos(phases - math.atan2(kappa_y, kappa_x)) + stick = population.k_f * population.r_helix_m * cosine * kappa + slipping = int( + np.count_nonzero(np.abs(stress - stick) > 1e-9 * (np.abs(stick) + 1.0)) + ) else: phi_bend = math.atan2(kappa_y, kappa_x) stations = np.arange(layer.n_cores) * model.spec.n_stations_per_core @@ -490,9 +536,11 @@ def _core_axis( return _CoreAxis( stuck, frictional, - f"core friction coefficient {model.mu_effective:.3g}, stick coefficient " - f"{model.xi:.3g}, contact line load {model.loads.total_N_per_m:.4g} N/m per " - f"core; {slipping} of {layer.n_cores} cores slipping in this section", + f"core friction coefficient {model.mu_effective:.3g}" + + (" (relative core-core slip)" if model.coupling is not None else "") + + f", stick coefficient {model.xi:.3g}, contact line load " + f"{model.loads.total_N_per_m:.4g} N/m per core; {slipping} of " + f"{layer.n_cores} cores slipping in this section", ) @@ -553,6 +601,7 @@ def _resolved_core_states( """ phi = np.linspace(0, 2 * math.pi, n_points, endpoint=False) beta = core_angle(section_state.cable, layer) + r_c = float(layer.r_offset_m or 0.0) e = section_state.youngs_modulus_Pa[layer.name] out: dict[str, list[np.ndarray]] = {} for state in CORE_SLIP_STATES: @@ -571,6 +620,22 @@ def _resolved_core_states( local_x, local_y = core_bending_components( beta, phase, kappa_x, kappa_y ) + # The normal curvature of the core follows its slip state. + local_x += float( + _core_slip_curvature(beta, r_c, float(axis_strain[core])) + ) + ring_strain = ( + c2 + * ring.r_helix_m + * (local_x * np.cos(phi) + local_y * np.sin(phi)) + ) + # The ring wires carry the ring strain (held to the core axis) + # or none (free), which sets their own normal curvature. + held = ( + e * ring_strain + if state != "free" and ring.r_helix_m > 0.0 + else None + ) amp = local_bending_amplitude( math.hypot(local_x, local_y), phi, @@ -578,11 +643,8 @@ def _resolved_core_states( ring.d_wire_m, ring.lay_angle_rad, math.atan2(local_y, local_x), - ) - ring_strain = ( - c2 - * ring.r_helix_m - * (local_x * np.cos(phi) + local_y * np.sin(phi)) + friction_stress_Pa=held, + r_helix_m=ring.r_helix_m if held is not None else None, ) if state == "free": centre = np.full(n_points, mean) @@ -612,6 +674,7 @@ def _laid_annulus_states( scales the bending about the core's own axis (:func:`own_bending_ratio`). """ beta = core_angle(section_state.cable, layer) + r_c = float(layer.r_offset_m or 0.0) theta = np.linspace(0, 2 * math.pi, n_points, endpoint=False) if radius is None: radius = layer.r_outer_m or 0.0 @@ -629,6 +692,7 @@ def _laid_annulus_states( for i in range(layer.n_cores): phase = 2 * math.pi * i / layer.n_cores bx, by = core_bending_components(beta, phase, kx, ky) + bx += float(_core_slip_curvature(beta, r_c, float(axis_strain[i]))) bending = e * c2 * (bx * local_x + by * local_y) chunks.append(mean + bending + e * c2 * axis_strain[i]) out[state] = chunks @@ -1826,8 +1890,11 @@ def core_component_utilisation( c, s = math.cos(beta), math.sin(beta) radial = kx * np.cos(phi) + ky * np.sin(phi) tangential = -kx * np.sin(phi) + ky * np.cos(phi) + # The normal curvature of the core follows its slip state. local = np.hypot( - c * c * math.cos(2 * beta) * radial, c * (1 + s * s) * tangential + c * c * math.cos(2 * beta) * radial + + _core_slip_curvature(beta, float(layer.r_offset_m or 0.0), axis), + c * (1 + s * s) * tangential, ) c2 = axial_cosine(layer) ** 2 lever = own_bending_ratio(layer) * float(layer.r_outer_m or 0.0) diff --git a/src/cablexsec/analysis/fast_field.py b/src/cablexsec/analysis/fast_field.py index 5fd62e3..8641233 100644 --- a/src/cablexsec/analysis/fast_field.py +++ b/src/cablexsec/analysis/fast_field.py @@ -9,8 +9,10 @@ arithmetic of the NumPy expressions it replaces, operation for operation: the local bending stress of :func:`cablexsec.mechanics.wire_stress.local_bending_fibre_stress` at the -outward radial fibre and at the edge (fibre angle ``pi/2``), the outward -total ``((sigma_A + sigma_B) + sigma_f) + sigma_T`` plus any termination +outward radial fibre and at the edge (fibre angle ``pi/2``), with the +normal curvature of the wire's slip state from its friction stress (and any +termination increment) when the helix radius is given, the outward total +``((sigma_A + sigma_B) + sigma_f) + sigma_T`` plus any termination increment, and ``mean = outward - radial``. The trigonometric factors are evaluated by NumPy, as in the reference expressions, and passed in. The results are equal to the NumPy path bit for bit @@ -28,6 +30,7 @@ from numpy.typing import NDArray from cablexsec._numba import HAVE_NUMBA, njit +from cablexsec.exceptions import CableInputError __all__ = ["HAVE_NUMBA", "assemble_wire_field"] @@ -53,6 +56,9 @@ def _assemble_kernel( thermal: FloatArray, extra: FloatArray, has_extra: bool, + modulus: FloatArray, + slip_coefficient: float, + has_slip: bool, ) -> tuple[FloatArray, FloatArray, FloatArray]: n_w, n_t = friction.shape mean = np.empty((n_w, n_t)) @@ -65,6 +71,11 @@ def _assemble_kernel( x = kx[i] y = ky[i] rb = c_radial * (x * cp + y * sp) + if has_slip: + f = friction[w, i] + if has_extra: + f = f + extra[w, i] + rb = rb + slip_coefficient * (f / modulus[i]) tb = c_tangential * ((-x) * sp + y * cp) sb = coef_radial[i] * (rb * cos_outward + tb * sin_outward) out = ((axial[i] + sb) + friction[w, i]) + thermal[i] @@ -88,22 +99,29 @@ def assemble_wire_field( friction_Pa: FloatArray, thermal_Pa: FloatArray, extra_Pa: FloatArray | None = None, + r_helix_m: float | None = None, ) -> tuple[FloatArray, FloatArray, FloatArray]: """``(mean, radial, tangential)`` of the wire stress field [Pa]. - Equal bit for bit to the NumPy expressions :: + Equal to the NumPy expressions :: - radial = local_bending_fibre_stress(kx, ky, phi[:, None], E, depth, a) + held = friction + extra # friction alone without extra + radial = local_bending_fibre_stress( + kx, ky, phi[:, None], E, depth, a, + friction_stress_Pa=held, r_helix_m=r_helix_m, + ) tangential = local_bending_fibre_stress( - kx, ky, phi[:, None], E, width, a, pi / 2 + kx, ky, phi[:, None], E, width, a, pi / 2, + friction_stress_Pa=held, r_helix_m=r_helix_m, ) outward = axial[None, :] + radial + friction + thermal[None, :] outward = outward + extra # when given mean = outward - radial - ``modulus_Pa`` is a constant or one value per sample; ``axial_Pa`` and - ``thermal_Pa`` hold one value per sample, ``friction_Pa`` and - ``extra_Pa`` one row per wire. + ``r_helix_m=None`` leaves out the normal curvature of the slip state + (``friction_stress_Pa=None`` above). ``modulus_Pa`` is a constant or one + value per sample; ``axial_Pa`` and ``thermal_Pa`` hold one value per + sample, ``friction_Pa`` and ``extra_Pa`` one row per wire. """ kx = np.ascontiguousarray(kappa_x, dtype=np.float64) ky = np.ascontiguousarray(kappa_y, dtype=np.float64) @@ -116,7 +134,15 @@ def assemble_wire_field( c, s = math.cos(lay_angle_rad), math.sin(lay_angle_rad) c_radial = c * c * math.cos(2 * lay_angle_rad) c_tangential = c * (1 + s * s) + has_slip = r_helix_m is not None + slip_coefficient = 0.0 + if r_helix_m is not None: + if not (math.isfinite(r_helix_m) and r_helix_m > 0.0): + raise CableInputError("the helix radius must be finite and positive") + # As slip_state_normal_curvature forms it. + slip_coefficient = math.sin(lay_angle_rad) ** 2 / r_helix_m modulus = np.asarray(modulus_Pa) + modulus_t = np.ascontiguousarray(np.broadcast_to(modulus, (n_t,)), dtype=np.float64) coef_radial = np.ascontiguousarray( np.broadcast_to(modulus * depth_m / 2, (n_t,)), dtype=np.float64 ) @@ -148,4 +174,7 @@ def assemble_wire_field( np.ascontiguousarray(thermal_Pa, dtype=np.float64), extra, extra_Pa is not None, + modulus_t, + slip_coefficient, + has_slip, ) diff --git a/src/cablexsec/analysis/fatigue.py b/src/cablexsec/analysis/fatigue.py index 506db89..3d0c64f 100644 --- a/src/cablexsec/analysis/fatigue.py +++ b/src/cablexsec/analysis/fatigue.py @@ -841,7 +841,9 @@ def _wire_stress_series( Shape ``(n_wires, n_steps)``; ``sigma_total = sigma_A + sigma_B + sigma_f + sigma_T`` with the parts of :func:`_wire_stress_parts` (same options) and the local bending stress at the outer face (``t/2`` for a - rectangular or profiled wire, gap G1). + rectangular or profiled wire, gap G1), whose normal curvature follows + the slip state of the friction stress + (:func:`~cablexsec.mechanics.wire_stress.slip_state_normal_curvature`). """ parts = _wire_stress_parts( layer, @@ -869,6 +871,8 @@ def _wire_stress_series( spec.E_wire_Pa if wire_modulus_Pa is None else wire_modulus_Pa, d_wire, spec.lay_angle_rad, + friction_stress_Pa=parts.friction, + r_helix_m=spec.r_helix_m, ) return np.asarray( parts.axial[None, :] + sigma_B_kt + parts.friction + parts.thermal[None, :] @@ -1276,7 +1280,14 @@ def wire_stress_field( Local tendon bending (gap G1, :mod:`cablexsec.mechanics.tendon_bending`). A rectangular or profiled wire (``layer.spec.section``) takes its local - bending at the outer face ``t/2`` and the edge ``b/2``. ``transverse`` + bending at the outer face ``t/2`` and the edge ``b/2``. The normal + (radial) curvature follows each wire's axial slip state: the + deformed-helix term ``cos^2 a cos 2a p_n`` plus ``(sin^2 a / r_h) + sigma_f / E`` of the friction stress the wire carries, with any + termination increment + (:func:`~cablexsec.mechanics.wire_stress.slip_state_normal_curvature`): + ``cos^4 a`` for a stuck wire with ``xi = 1``, ``cos^2 a cos 2a`` without + friction stress. ``transverse`` (:class:`~cablexsec.mechanics.tendon_bending.TransverseSlipModel`) adds the transverse slip towards the geodesic per wire (Jenkin element): the lateral curvature becomes ``cos a (1 + sin^2 a) p_l - k^2 v`` and the @@ -1426,8 +1437,12 @@ def wire_stress_field( depth = 2 * spec.section.half_thickness_m width = 2 * spec.section.half_width_m phi_eval = spec.phi_wires if wires is None else spec.phi_wires[wires] + # The normal curvature of each wire's slip state is set by the axial + # stress the wire carries from bending: its friction stress with any + # termination clamp increment. + held = parts.friction if extra is None else parts.friction + extra if _FAST_FIELD: - # One compiled pass, equal bit for bit to the expressions below. + # One compiled pass, with the arithmetic of the expressions below. mean, radial, tangential = assemble_wire_field( kx, ky, @@ -1440,6 +1455,7 @@ def wire_stress_field( parts.friction, parts.thermal, extra, + spec.r_helix_m, ) else: # Outward radial fibre (y_n = t/2) and edge (y_l = b/2); a rectangular @@ -1451,6 +1467,8 @@ def wire_stress_field( modulus, depth, spec.lay_angle_rad, + friction_stress_Pa=held, + r_helix_m=spec.r_helix_m, ) tangential = local_bending_fibre_stress( kx, @@ -1460,6 +1478,8 @@ def wire_stress_field( width, spec.lay_angle_rad, math.pi / 2, + friction_stress_Pa=held, + r_helix_m=spec.r_helix_m, ) outward = ( parts.axial[None, :] + radial + parts.friction + parts.thermal[None, :] diff --git a/src/cablexsec/analysis/kinematics.py b/src/cablexsec/analysis/kinematics.py index 43c0d12..baa5516 100644 --- a/src/cablexsec/analysis/kinematics.py +++ b/src/cablexsec/analysis/kinematics.py @@ -78,7 +78,8 @@ strain; the ends are held against twist, so the twist is zero. The centre-line wire stress is ``E cos^2 a eps0 + sigma_f``; the utilisation is the largest stress round the wire (with its local bending, -:func:`~cablexsec.mechanics.wire_stress.local_bending_fibre_stress`) over the +:func:`~cablexsec.mechanics.wire_stress.local_bending_fibre_stress`, whose +normal curvature follows the friction stress of the station) over the yield stress of the armour material. The transverse slip of the wire from its loxodrome @@ -111,6 +112,7 @@ from cablexsec.mechanics.core_friction import ( CoreFrictionSpec, build_core_friction, + core_station_history, resolve_core_friction, ) from cablexsec.mechanics.distributed_friction import distributed_friction_history @@ -568,8 +570,14 @@ def _bending( phi: FloatArray, kx: FloatArray, ky: FloatArray, + friction: FloatArray, ) -> tuple[FloatArray, FloatArray]: - """Local bending stress at the outer face and the edge (stations, kept).""" + """Local bending stress at the outer face and the edge (stations, kept). + + The normal curvature follows each station's slip state through its + friction stress + (:func:`~cablexsec.mechanics.wire_stress.slip_state_normal_curvature`). + """ depth = 2.0 * section.half_thickness_m width = 2.0 * section.half_width_m radial = local_bending_fibre_stress( @@ -579,6 +587,8 @@ def _bending( spec.E_wire_Pa, depth, spec.lay_angle_rad, + friction_stress_Pa=friction, + r_helix_m=spec.r_helix_m, ) tangential = local_bending_fibre_stress( kx[None, :], @@ -588,6 +598,8 @@ def _bending( width, spec.lay_angle_rad, math.pi / 2, + friction_stress_Pa=friction, + r_helix_m=spec.r_helix_m, ) return np.asarray(radial), np.asarray(tangential) @@ -645,7 +657,7 @@ def _armour_field( slip, slipping, share = _spring_slider_slip(spec, phi, stress, drive, sign) friction = stress[:, drive.kept] kx, ky = drive.kx[drive.kept], drive.ky[drive.kept] - radial, tangential = _bending(spec, section, phi, kx, ky) + radial, tangential = _bending(spec, section, phi, kx, ky, friction) transverse_slip = None if transverse is not None: transverse_slip, radial, tangential = _transverse( @@ -789,12 +801,7 @@ def _core_field( model = build_core_friction(cable, spec, tension_N, contact_model=contact_model) population = model.population - history = wire_slip_history( - population, - drive.kx, - drive.ky, - direction_hold_fraction=spec.direction_hold_fraction, - ) + history = core_station_history(model, drive.kx, drive.ky) phi = np.asarray(population.phi_wires, dtype=np.float64) lay = cable.core_lay sign = _lay_sign(lay.lay_direction) if lay is not None else 1 diff --git a/src/cablexsec/analysis/rig_test.py b/src/cablexsec/analysis/rig_test.py index df00ac3..5868c87 100644 --- a/src/cablexsec/analysis/rig_test.py +++ b/src/cablexsec/analysis/rig_test.py @@ -28,7 +28,8 @@ Sectional friction and local bending: the package laws at the local curvature ``kappa(x, t) = kappa_ref(t) k_hat(x)`` (direction-tied friction, :func:`~cablexsec.mechanics.fast_slip.wire_friction_stress`; outward-fibre -local bending, :func:`~cablexsec.mechanics.wire_stress.local_bending_fibre_stress`). +local bending, :func:`~cablexsec.mechanics.wire_stress.local_bending_fibre_stress`, +whose normal curvature follows the friction strain the wire carries). Clamp: each wire is followed along the whole specimen with the anchored-wire solver of :mod:`cablexsec.mechanics.clamp_layer` (anchors at both clamps, @@ -1447,34 +1448,42 @@ def rng(values: FloatArray) -> float: def bending( theta: float, + friction_microstrain: FloatArray, kx: FloatArray = kx_local, sp: HelicalLayerSpec = spec, d: float = diameter, ) -> FloatArray: + # Outer-face local bending; its normal curvature follows the + # wire's slip state through the friction strain it carries. stress = local_bending_fibre_stress( - kx, 0.0, theta, sp.E_wire_Pa, d, sp.lay_angle_rad, 0.0 + kx, + 0.0, + theta, + sp.E_wire_Pa, + d, + sp.lay_angle_rad, + 0.0, + friction_stress_Pa=friction_microstrain * 1e-6 * sp.E_wire_Pa, + r_helix_m=sp.r_helix_m, ) return np.asarray(stress / sp.E_wire_Pa * 1e6) nominal = runs[(g.layer, *nominal_key)] theta_g = nominal.theta[i] - bend = bending(theta_g) friction = nominal.friction[i] + bend = bending(theta_g, friction) total = axial + bend + friction - by_mu = { - mu_nominal[g.layer] * f: rng( - axial + bend + runs[(g.layer, f, nominal_setback)].friction[i] + by_mu: dict[float, float] = {} + for f in mu_values: + held = runs[(g.layer, f, nominal_setback)].friction[i] + by_mu[mu_nominal[g.layer] * f] = rng(axial + bending(theta_g, held) + held) + by_setback: dict[float, float] = {} + for sb in setbacks: + run = runs[(g.layer, 1.0, sb)] + by_setback[sb] = rng( + axial + bending(run.theta[i], run.friction[i]) + run.friction[i] ) - for f in mu_values - } - by_setback = { - sb: rng( - axial - + bending(runs[(g.layer, 1.0, sb)].theta[i]) - + runs[(g.layer, 1.0, sb)].friction[i] - ) - for sb in setbacks - } + sectional = nominal.sectional[i] results.append( GaugeResult( location=g, @@ -1492,7 +1501,7 @@ def bending( "total": rng(total), }, range_by_mu=by_mu, - range_sectional=rng(axial + bend + nominal.sectional[i]), + range_sectional=rng(axial + bending(theta_g, sectional) + sectional), range_by_setback=by_setback, ) ) diff --git a/src/cablexsec/analysis/section_properties.py b/src/cablexsec/analysis/section_properties.py index 0627595..1bc9255 100644 --- a/src/cablexsec/analysis/section_properties.py +++ b/src/cablexsec/analysis/section_properties.py @@ -87,6 +87,7 @@ from cablexsec.mechanics.core_friction import ( CoreFrictionSpec, build_core_friction, + core_full_slip_curvature, resolve_core_friction, ) from cablexsec.mechanics.papailiou import full_slip_curvature, slip_onset_curvature @@ -1111,7 +1112,7 @@ def _core_slip( model.mu_effective, model.xi, slip_onset_curvature(population), - full_slip_curvature(population), + core_full_slip_curvature(model), model.stick_EI_Nm2, None if fillers is None else fillers.line_load_N_per_m, None if fillers is None else slip_onset_curvature(fillers.population), diff --git a/src/cablexsec/analysis/stress.py b/src/cablexsec/analysis/stress.py index e16c5fb..79028da 100644 --- a/src/cablexsec/analysis/stress.py +++ b/src/cablexsec/analysis/stress.py @@ -20,7 +20,11 @@ ============ ====================================================== ============== with ``σ_total = σ_A + σ_B + σ_f + σ_T`` and ``p_0`` the Hertz peak pressure of -the opposite-laid armour crossing. +the opposite-laid armour crossing. The normal (radial) curvature in ``σ_B`` +follows each wire's slip state: ``cos²α cos2α κ cosθ + (sin²α / r) σ_f / E`` +(:func:`~cablexsec.mechanics.wire_stress.slip_state_normal_curvature`), which +is ``cos⁴α`` for a stuck wire with ``ξ = 1`` and the Eq. 14 value +``cos²α cos2α`` for a wire without friction stress. The retained sigma_vm names do not denote a resolved contact tensor invariant: the axial and contact terms need not be coincident, and the result is not a proven upper bound. A local contact assessment must recover coincident tensors. @@ -78,6 +82,7 @@ from cablexsec.mechanics.wire_stress import ( local_bending_amplitude, local_bending_stress, + slip_state_normal_curvature, von_mises_stress, ) from cablexsec.provenance import Provenance, require_finite @@ -397,11 +402,22 @@ def compute_stress( # second thermal increment or replace it with N/EA. sigma_A_val = section_state.layers[lyr.name].longitudinal_stress_Pa sigma_A = np.full(spec.n_wires, sigma_A_val) - # sigma_B: local wire bending ([MenardCartraud2023] Eq. 14). + # sigma_B: local wire bending ([MenardCartraud2023] Eq. 14), with the + # normal curvature of each wire's slip state from its friction stress + # (cos^4 a stuck at xi = 1, cos^2 a cos 2a without friction stress). section = spec.section depth = d_wire if section is None else 2.0 * section.half_thickness_m sigma_B = np.asarray( - local_bending_stress(kappa_mag, phi, e_w, depth, a, phi_bend) + local_bending_stress( + kappa_mag, + phi, + e_w, + depth, + a, + phi_bend, + friction_stress_Pa=sigma_f, + r_helix_m=r_h, + ) ) # sigma_T: fully restrained thermal increment (0 if isothermal). # Heating at fixed global strain is compressive in the tensile-positive @@ -428,12 +444,22 @@ def compute_stress( sigma_vm = np.asarray(von_mises_stress(sigma_total, p0)) if section is None: bending_amplitude = local_bending_amplitude( - kappa_mag, phi, e_w, d_wire, a, phi_bend + kappa_mag, + phi, + e_w, + d_wire, + a, + phi_bend, + friction_stress_Pa=sigma_f, + r_helix_m=r_h, ) else: # Rectangular/profiled wire (gap G1): corner of the section. s_a = math.sin(a) - face = e_w * kappa_mag * cos_b**2 * math.cos(2 * a) * cphi + face = e_w * ( + kappa_mag * cos_b**2 * math.cos(2 * a) * cphi + + slip_state_normal_curvature(sigma_f, e_w, a, r_h) + ) edge = e_w * kappa_mag * cos_b * (1 + s_a * s_a) * np.sin(phi - phi_bend) bending_amplitude = section.max_bending_stress( face * section.half_thickness_m, edge * section.half_width_m diff --git a/src/cablexsec/analysis/tape.py b/src/cablexsec/analysis/tape.py index 4f3c724..2238235 100644 --- a/src/cablexsec/analysis/tape.py +++ b/src/cablexsec/analysis/tape.py @@ -54,7 +54,11 @@ ``sigma_0 = rho (P1 + P2) / (t sin^2 beta)`` and ``psi`` the helix angle from the neutral line of the current bending direction ([Papailiou1997]; the per-unit-length friction force of a tape is - ``mu (P1 + P2) w``), plus the uniform part. + ``mu (P1 + P2) w``), plus the uniform part. The flat-wise bending of the + free state gains, in this state, ``+-(t/2) (sin^2 beta / rho) sigma / E`` + of the bending stress ``sigma`` the line carries: the normal curvature of + a helix follows its axial slip state + (:func:`~cablexsec.mechanics.wire_stress.slip_state_normal_curvature`). Slip and overlap ---------------- @@ -129,6 +133,7 @@ from cablexsec.mechanics.core_friction import CoreFrictionSpec from cablexsec.mechanics.core_kinematics import CoreSlipState, core_kinematics from cablexsec.mechanics.radial_cable import CableRadialState +from cablexsec.mechanics.wire_stress import slip_state_normal_curvature from cablexsec.provenance import Provenance __all__ = [ @@ -300,6 +305,7 @@ def tape_strain( else: last = direction[i] line_strain: dict[float, FloatArray] = {} + line_bending: dict[float, FloatArray] = {} for w_pos in lines: ang = theta + w_pos * geometry.edge_angle_rad bend_stuck = rho * ( @@ -324,6 +330,7 @@ def tape_strain( bend_stuck, direction, ang, k, sigma0, mu * math.sin(beta) ) membrane = uniform + stress / E_Pa + line_bending[w_pos] = stress / E_Pa line_strain[w_pos] = membrane if w_pos == 0.0: # slip along the tape: integral of (stuck - carried) strain @@ -357,6 +364,12 @@ def tape_strain( value = line_strain[w_pos] if state != "stuck": value = value + face * half_t * flat + if w_pos in line_bending: + # The flat-wise curvature follows the slip state of the + # line: (sin^2 beta / rho) times its bending strain. + value = value + face * half_t * slip_state_normal_curvature( + line_bending[w_pos], 1.0, beta, rho + ) if path == "loxodromic" and w_pos != 0.0: value = value + w_pos * half_w * edge else: diff --git a/src/cablexsec/api.py b/src/cablexsec/api.py index 6f0c35b..bc3111c 100644 --- a/src/cablexsec/api.py +++ b/src/cablexsec/api.py @@ -212,6 +212,8 @@ STICK_SUPPORTS, axial_torsional_matrix, bending_stiffness_by_layer, + bonded_face_ei, + bonded_face_terms, ea_fixed, ea_free, ei_max_stuck, @@ -345,7 +347,8 @@ class StiffnessResult: ea_free_N : float Free-end (Schur-reduced) axial stiffness ``K_ee − K_et²/K_tt`` [N]. ei_min_Nm2 : float - Full-slip bending stiffness (individual-wire bending) [N·m²]. + Full-slip bending stiffness (individual-wire bending) [N·m²], plus the + elastic share of any bonded outer armour face (``bonded_face``, gap G8). ei_max_Nm2 : float No-slip bending stiffness with the selected shear compliance [N·m²]. This is not the component-axis plane-section limit when xi < 1. @@ -436,12 +439,18 @@ def compute_stiffness( lyr.name: xi_for_layer(cable, lyr.name, stick_support=stick_support) for lyr in cable.helical_layers } + for lyr in cable.helical_layers: + if lyr.bonded_face == "outer" and lyr.structural: + # Stuck, the support and the bond act in parallel (gap G8), as in + # the bending law: report that stick coefficient. + terms = bonded_face_terms(cable, lyr.name, xi_map[lyr.name]) + xi_map[lyr.name] = terms.xi_slider + terms.xi_bond bending = bending_stiffness_by_layer(cable, xi_map) return StiffnessResult( cable_name=cable.cable.name, ea_fixed_N=ea_fixed(cable), ea_free_N=ea_free(cable), - ei_min_Nm2=ei_min_slip(cable), + ei_min_Nm2=ei_min_slip(cable) + bonded_face_ei(cable), ei_max_Nm2=ei_max_stuck(cable, xi_map), gj_Nm2=at.K_tt, axial_torsion_coupling_Nm=at.K_et, @@ -663,13 +672,14 @@ def _prepare_mkappa_law( section_state=section_state, radial_state=radial_state, stick_support=stick_support, + bonded_faces=True, ) ei_min = ei_min_slip( cable, modulus_scale=section_state.modulus_scale if section_state is not None else None, - ) + ) + bonded_face_ei(cable) # the bonds' elastic share (gap G8); 0 without model = ( None if core_spec is None @@ -978,8 +988,21 @@ def compute_mkappa( raise CableSchemaError("contact_model must be 'bounded', 'qp' or 'solved'.") # Armour layers in the order of the law's specifications. names = [layer.name for layer in structural_armour_layers(cable)] + bonded = [ + layer.name + for layer in structural_armour_layers(cable) + if layer.bonded_face == "outer" + ] pressure_history: dict[str, FloatArray] | None = None if contact_pressure_Pa is not None: + if bonded: + # A P1+P2 history cannot be split into its faces without the + # contact state that produced it (gap G8). + raise CableSchemaError( + f"{', '.join(bonded)}: contact_pressure_Pa gives P1+P2, which a " + "bonded outer face cannot split into its sliding share; give " + "contact_tension_history_N instead" + ) pressure_history = _mkappa_pressure_history( contact_pressure_Pa, names, kappa.shape ) @@ -1001,6 +1024,37 @@ def compute_mkappa( cable, tension_history, contact_model, crossing_loads=False ) pressure_history = {name: histories[name] for name in names} + if bonded: + # A bonded outer face slides on its inner face only (gap G8): keep + # that face's share at every sample, as the specs do at a fixed + # tension. The bounded chain is affine in tension. + from cablexsec.cable_adapters import ( # noqa: PLC0415 + _bounded_face_pressures, + ) + from cablexsec.mechanics.axisymmetric import ( # noqa: PLC0415 + compute_contact_forces, + ) + + p_ext = cable.initial_state.external_pressure_Pa + scale = max(float(np.max(tension_history)), 1.0) + ends = [ + _bounded_face_pressures( + cable, + compute_contact_forces( + cable, t, p_ext_Pa=p_ext + ).interface_pressure_Pa, + p_ext, + ) + for t in (0.0, scale) + ] + for name in bonded: + (below0, above0), (below1, above1) = ends[0][name], ends[1][name] + below = below0 + (below1 - below0) * tension_history / scale + total = below + above0 + (above1 - above0) * tension_history / scale + share = np.divide( + below, total, out=np.zeros_like(total), where=total > 0.0 + ) + pressure_history[name] = pressure_history[name] * share # Soft guard: the linear-elastic wire-stress assumption holds below the # armour yield curvature (where the capacity envelope's wire-yield mechanism @@ -1109,7 +1163,12 @@ def compute_mkappa( else: method_extra = ( "; laid-core stick-slip (direction-tied Papailiou cap, " - f"{model.loads.source} core contact loads, stick coefficient " + + ( + "" + if model.coupling is None + else "relative core-core slip of neighbouring cores, " + ) + + f"{model.loads.source} core contact loads, stick coefficient " f"{model.xi:.3f}, effective friction coefficient " f"{model.mu_effective:.3f})" + ( @@ -1140,8 +1199,14 @@ def compute_mkappa( else "of the reference" ) + ", not changed by bending; the layers of a core move together; " - "core-core friction acts on the slip of each core relative to the " - "plane-section field", + + ( + "core-core friction acts on the slip of each core relative to the " + "plane-section field" + if model.coupling is None + else "core-core friction acts on the relative slip of neighbouring " + "cores (coupled stations, constant Coulomb bound of the core-core " + "load)" + ), "internal rings take the core contact line load by line-force " "conservation (upper estimate) and the cable curvature", ) diff --git a/src/cablexsec/cable_adapters.py b/src/cablexsec/cable_adapters.py index 56f6b30..a70e6af 100644 --- a/src/cablexsec/cable_adapters.py +++ b/src/cablexsec/cable_adapters.py @@ -582,6 +582,7 @@ def cable_to_mkappa_specs( section_state: SectionState | None = None, radial_state: CableRadialState | None = None, stick_support: str = "yun_stack", + bonded_faces: bool = False, ) -> list[HelicalLayerSpec]: r"""Build frozen M-κ specs for a cable's structural armour layers. @@ -598,14 +599,61 @@ def cable_to_mkappa_specs( :func:`~cablexsec.mechanics.stiffness.xi_for_layer` (``"yun_stack"``, the default, or the opt-in ``"annulus"``). + A layer with ``bonded_face="outer"`` (gap G8) slides on its inner face + only: its friction-setting pressure and normal load keep the inner face's + share ``P_inner / (P_inner + P_outer)`` of the bounded radial chain, and + its stick coefficient is the slider's share ``xi_tot - xi_bond`` of + :func:`~cablexsec.mechanics.stiffness.bonded_face_terms`. The bond's + elastic share is not in these specs: the bending law adds + :func:`~cablexsec.mechanics.stiffness.bonded_face_ei` to its parallel + EI. Only callers that do so pass ``bonded_faces=True``; any other route + (wire stress, fatigue, capacity) would miss the bond's share of the wire + force and is refused for such a cable. + Raises ------ CableSchemaError - If the cable has no fully-specified structural armour layer. + If the cable has no fully-specified structural armour layer, or + declares a bonded face on a route that does not support it. """ - from cablexsec.mechanics.stiffness import xi_for_layer # noqa: PLC0415 + from cablexsec.mechanics.stiffness import ( # noqa: PLC0415 + bonded_face_terms, + xi_for_layer, + ) require_fully_specified(cable, "cable_to_mkappa_specs") + bonded = [ + lyr for lyr in structural_armour_layers(cable) if lyr.bonded_face == "outer" + ] + face_split: dict[str, tuple[float, float]] = {} + if bonded: + names = ", ".join(lyr.name for lyr in bonded) + if not bonded_faces: + raise CableSchemaError( + f"{names}: bonded_face='outer' is implemented for the bending law " + "(compute_mkappa, SectionLaw, the exported law) and " + "compute_stiffness; this route would miss the bond's share of the " + "wire force" + ) + if ( + contact_model != "bounded" + or section_state is not None + or radial_state is not None + ): + raise CableSchemaError( + f"{names}: bonded_face='outer' is implemented with the bounded " + "contact model, without a section or radial state" + ) + if any( + lyr.winding_stress_Pa or lyr.pretension_Pa for lyr in cable.helical_layers + ): + raise CableSchemaError( + f"{names}: bonded_face='outer' with a declared winding stress or " + "pretension is not implemented (the face split of the pressure jump)" + ) + p_ext = cable.initial_state.external_pressure_Pa + loaded = compute_contact_forces(cable, tension_N, p_ext_Pa=p_ext) + face_split = _bounded_face_pressures(cable, loaded.interface_pressure_Pa, p_ext) if contact_model == "solved" and radial_state is None: radial_state = solve_cable_radial_state(cable, tension_N) fn_map = _normal_force_map( @@ -629,6 +677,20 @@ def cable_to_mkappa_specs( mu_eff = ( mu if mu is not None else library.get_property(lyr.material, "mu_on_hdpe") ) + xi = xi_for_layer( + cable, + lyr.name, + youngs_modulus_Pa=section_state.youngs_modulus_Pa + if section_state is not None + else None, + stick_support=stick_support, + ) + f_n, pressure = fn_map[lyr.name], pressure_map[lyr.name] + if lyr.bonded_face == "outer": + below, above = face_split[lyr.name] + share = below / (below + above) if below + above > 0.0 else 0.0 + f_n, pressure = f_n * share, pressure * share + xi = bonded_face_terms(cable, lyr.name, xi).xi_slider specs.append( HelicalLayerSpec( n_wires=lyr.n_wires, @@ -640,18 +702,11 @@ def cable_to_mkappa_specs( A_wire_m2=math.pi * lyr.d_wire_m**2 / 4.0 if lyr.wire_shape == "round" else lyr.wire_section.area, - xi=xi_for_layer( - cable, - lyr.name, - youngs_modulus_Pa=section_state.youngs_modulus_Pa - if section_state is not None - else None, - stick_support=stick_support, - ), + xi=xi, mu=mu_eff, - F_n_axi_N=fn_map[lyr.name], + F_n_axi_N=f_n, shape_g=None, - contact_pressure_Pa=pressure_map[lyr.name], + contact_pressure_Pa=pressure, normal_load_is_line=True, section=None if lyr.wire_shape == "round" else lyr.wire_section, ) diff --git a/src/cablexsec/cables/schema.py b/src/cablexsec/cables/schema.py index 7150936..1442ab9 100644 --- a/src/cablexsec/cables/schema.py +++ b/src/cablexsec/cables/schema.py @@ -587,6 +587,16 @@ class HelicalLayer(_LayerBase): # curvature of the wire's individual bending in the full-slip bending # stiffness (cablexsec.mechanics.tendon_bending.curvature_coefficients). transverse_slip_fraction: float = 0.0 + # Interface condition of the layer's outer face (gap G8). "none" (default): + # both faces slide by Coulomb friction. "outer": the outer face is bonded, + # for example a sheath extruded directly onto the wires (no tape between) + # or a bitumen or compound bond; it carries no slip, only the elastic + # coupling of the polymer outside (cablexsec.mechanics.stiffness + # .bonded_face_terms). Allowed on the outermost helical layer with + # cylindrical polymer layers outside it. Used by the bending law + # (compute_mkappa, SectionLaw, the exported law) and compute_stiffness; + # the wire-stress routes refuse it. + bonded_face: Literal["none", "outer"] = "none" # Declared manufacturing clamping state (value, basis, source); see # ManufacturingClamping and cablexsec.clamping. When given it sets the # equivalent legacy field below, which every contact route reads. diff --git a/src/cablexsec/cables/zeidan2025.yaml b/src/cablexsec/cables/zeidan2025.yaml index b8b0ca6..ff1a6e7 100644 --- a/src/cablexsec/cables/zeidan2025.yaml +++ b/src/cablexsec/cables/zeidan2025.yaml @@ -161,6 +161,12 @@ layers: lay_angle_deg: 14.23 # atan(2 pi r / 1233 mm) lay_direction: left_hand # pitch -1233 mm bulk_sn: saevik_2011_flat_steel + # Outer face bonded to the sheath (gap G8). Not published: the sheath sits + # on the wires with no tape in [Zeidan2025] Table 5.2 and Fig. 5.2, and the + # bonded state is the one that matches the measured post-slip slope of the + # stabilised loops (range growth 11.2 / 8.7 / 8.1 kN m2 between 30 and + # 60 mm against 2.7 kN m2 with both faces sliding). An identified input. + bonded_face: outer source: "[Zeidan2026] Table 3 (armouring exterior OD 103 mm, 82 x 3.5 mm, pitch -1233 mm)" - name: outer_sheath diff --git a/src/cablexsec/mechanics/core_friction.py b/src/cablexsec/mechanics/core_friction.py index 5e87ee3..f506a49 100644 --- a/src/cablexsec/mechanics/core_friction.py +++ b/src/cablexsec/mechanics/core_friction.py @@ -144,6 +144,45 @@ The internal rings keep the [KarlsenHusoy2026] operator in every model. +Core--core coupling +------------------- +``CoreFrictionSpec(core_core_coupling=...)`` sets the slip on which the +core--core friction acts: + +* ``"absolute"`` (default): every contact of a core, the neighbouring cores + included, resists the slip of that core relative to the plane-section + field, like a helix on a fixed cylinder, with the load-weighted coefficient + ``mu_eff``. Under planar bending full slip comes at ``pi / 2`` times the + onset curvature. +* ``"relative"``: a coupled intralayer slip model of laid cores. The + neighbouring cores of the layer touch at the same axial position, and the + friction between two of them resists their relative slip ``u_i - u_j``; the + filler and ring contacts (interlayer) keep the absolute slip. The stations + of the ``n`` cores at one axial position form a group + (:mod:`cablexsec.mechanics.station_coupling`): the station stress is the + interlayer share, bounded as above with the interlayer coefficient + ``mu_a = (mu_cf q_cf + mu_cs q_cs) / q_core`` (the capstan form kept on this + share), plus the intralayer share, bounded by the constant Coulomb bound + ``sigma_0 mu_cc (q_cc / q_core) |sin beta| min(psi, pi / n)``, and the + intralayer shares of a group sum to zero. The return map is the closest + point of the group on that set. For three cores with core--core contact + only, slip starts at the same onset curvature, the largest frozen friction + stress at full slip is ``2/3`` of the absolute value (the stress plateaus + beyond ``pi / 3`` from the neutral axis), the full-slip moment is + ``sqrt(3)/2`` of the absolute one and full slip comes at + ``2 pi / (3 sqrt 3) = 1.209`` times the onset curvature. These match an + independent field solver of the coupled axial equilibrium of the cores + (``validation/scripts/coupled_core_slip_reference.py``) on monotonic and + reversed planar paths, with and without interlayer friction. Two cores + slip relative to each other in the sense of their absolute slip, and the + coupled law then differs from the absolute one only by the capstan term of + the core--core share. Without core--core load (a central filler) the two + options agree. The stick coefficient, the contact loads, the filler + profiles and the internal rings are the same in both. The relative coupling + is a direction-tied law: it takes no distributed model, and + ``friction_model="auto"`` keeps it on a non-planar path with a + :class:`~cablexsec.provenance.FrictionModelFallbackWarning`. + Contact loads over a tension history ------------------------------------ :func:`core_load_history` evaluates the core and profile contact loads of the @@ -175,8 +214,12 @@ * The layers of one core are bonded and move together axially; the core is a rod of rigidity ``EA_core`` whose interior shear enters only through ``xi``. -* Core--core friction is applied to the slip of each core relative to the - plane-section field, as are the filler and sheath contacts. +* With ``core_core_coupling="absolute"`` (default) core--core friction is + applied to the slip of each core relative to the plane-section field, as + are the filler and sheath contacts; ``"relative"`` applies it to the + relative slip of neighbouring cores (section "Core--core coupling"), with + the constant Coulomb bound of the core--core load (no capstan term on that + share) and pointwise station bounds, as the direction-tied law. * The contact width for ``k_s`` is the core perimeter. * Internal rings use the cable curvature times the helical-rod bending factor of the core lay; their external contact pressure is the core contact line @@ -214,12 +257,19 @@ from cablexsec.mechanics.papailiou import ( DIRECTION_HOLD_FRACTION, BendingWork, + WireSlipHistory, + coupled_slip_stress_bounds, + full_slip_curvature, wire_slip_history, wire_slip_stress_bounds, ) from cablexsec.mechanics.radial_cable import CableRadialState from cablexsec.mechanics.section_geometry import is_interstitial_filler from cablexsec.mechanics.section_state import SectionState +from cablexsec.mechanics.station_coupling import ( + StationCoupling, + project_station_groups, +) from cablexsec.mechanics.stiffness import axial_stiffness_by_layer, ea_fixed from cablexsec.mechanics.strand_slip import ( ConductorRing, @@ -234,9 +284,11 @@ ) __all__ = [ + "CORE_CORE_COUPLINGS", "CORE_FRICTION_MODELS", "CORE_LOAD_MODES", "CoreContactLoads", + "CoreCoreCoupling", "CoreFrictionHistory", "CoreFrictionModel", "CoreFrictionModelName", @@ -248,7 +300,11 @@ "build_core_friction", "core_contact_loads", "core_friction_history", + "core_full_slip_curvature", + "core_full_slip_moment", "core_load_history", + "core_station_bounds", + "core_station_history", "resolve_core_friction", ] @@ -261,6 +317,11 @@ #: history (:func:`core_load_history`) or hold the ``"reference"`` state. CoreLoadMode = Literal["follow", "reference"] CORE_LOAD_MODES: tuple[str, ...] = ("follow", "reference") +#: Slip on which the core--core friction acts (module notes): ``"absolute"`` +#: (each core against the plane section, default) or ``"relative"`` (the +#: relative slip of neighbouring cores). +CoreCoreCoupling = Literal["absolute", "relative"] +CORE_CORE_COUPLINGS: tuple[str, ...] = ("absolute", "relative") #: Solved tensions of a solved-model load history before it is interpolated. _SOLVED_LOAD_NODES = 33 @@ -314,6 +375,11 @@ class CoreFrictionSpec: mu_filler_profile : float or None Friction coefficient of the profile contacts (default: ``mu_core_filler``). + core_core_coupling : {"absolute", "relative"} + Slip on which the core--core friction acts (module notes, section + "Core--core coupling"): ``"absolute"`` (default) the slip of each core + relative to the plane section, ``"relative"`` the relative slip of + neighbouring cores (coupled stations; direction-tied law only). """ mu_core_filler: float = DEFAULT_CORE_MU @@ -329,6 +395,7 @@ class CoreFrictionSpec: central_filler: bool | None = None filler_profiles: bool = False mu_filler_profile: float | None = None + core_core_coupling: CoreCoreCoupling = "absolute" @property def filler_mu(self) -> float: @@ -348,6 +415,11 @@ def __post_init__(self) -> None: raise CableInputError("central_filler must be None, True or False") if not isinstance(self.filler_profiles, bool): raise CableInputError("filler_profiles must be True or False") + if self.core_core_coupling not in CORE_CORE_COUPLINGS: + raise CableInputError( + f"core_core_coupling must be one of {CORE_CORE_COUPLINGS}, " + f"got {self.core_core_coupling!r}" + ) for name in ("mu_strand", "mu_strand_outer", "mu_filler_profile"): value = getattr(self, name) if value is not None and (not math.isfinite(value) or value < 0.0): @@ -409,6 +481,13 @@ def mu_effective(self, spec: CoreFrictionSpec) -> float: + spec.mu_core_sheath * self.core_sheath_N_per_m ) / total + def mu_interlayer(self, spec: CoreFrictionSpec) -> float: + """Interlayer (filler and ring) friction over the total core load, + ``(mu_cf q_cf + mu_cs q_cs) / q_core`` (``mu_core_filler`` if + unloaded): the coefficient of the interlayer share of the relative + coupling, :meth:`mu_effective` with ``mu_core_core = 0``.""" + return self.mu_effective(dataclasses.replace(spec, mu_core_core=0.0)) + def _core_layers(cable: CableData) -> list[CylindricalOffsetLayer]: return [x for x in cable.layers if isinstance(x, CylindricalOffsetLayer)] @@ -644,6 +723,9 @@ class CoreFrictionModel: strand_rings: tuple[StrandRingFriction, ...] = field(default=()) tension_N: float = 0.0 fillers: FillerProfiles | None = None + #: Coupled station groups of ``core_core_coupling="relative"`` (``None``: + #: the absolute law). + coupling: StationCoupling | None = None @property def core_stick_EI_Nm2(self) -> float: @@ -918,6 +1000,16 @@ def build_core_friction( mu = loads.mu_effective(spec) n_st = n_cores * spec.n_stations_per_core area_core = math.pi * r_core**2 + coupling = None + if spec.core_core_coupling == "relative": + coupling = StationCoupling( + group_size=n_cores, + interlayer_mu=loads.mu_interlayer(spec), + intralayer_mu=spec.mu_core_core, + intralayer_pressure_Pa=n_cores + * loads.core_core_N_per_m + / (2.0 * math.pi * r_c), + ) population = HelicalLayerSpec( n_wires=n_st, r_helix_m=r_c, @@ -948,6 +1040,7 @@ def build_core_friction( if spec.filler_profiles else None ), + coupling=coupling, ) @@ -965,6 +1058,12 @@ class CoreLoadHistory: the most loaded sample. ``filler_profile_N_per_m`` and ``filler_pressure_Pa`` are those of the filler profiles (``None`` without them). ``contact_model`` names the model the loads come from. + + With ``core_core_coupling="relative"`` the core pressure and the capstan + coefficient are those of the interlayer share (the same rule with the + interlayer coefficient), and ``core_intralayer_pressure_Pa`` is the + pressure equivalent ``n q_cc / (2 pi r_c)`` of the core--core load at + every sample (``None`` for the absolute law). """ tension_N: FloatArray @@ -975,6 +1074,7 @@ class CoreLoadHistory: filler_profile_N_per_m: FloatArray | None = None filler_pressure_Pa: FloatArray | None = None core_mu_capstan: float | None = None + core_intralayer_pressure_Pa: FloatArray | None = None def _population_cap_per_pressure(spec: HelicalLayerSpec, mu: float) -> float: @@ -1054,17 +1154,30 @@ def follow(name: str) -> FloatArray: mu[positive] = weighted[positive] / total[positive] population = model.population pressure = model.n_cores * total / (2.0 * math.pi * model.r_offset_m) + # The capstan share: the whole load (absolute law) or the interlayer + # share (relative coupling, the coefficient with mu_core_core = 0). + share = mu reference_mu = float(population.mu) - if reference_mu <= 0.0 and np.any(mu[positive] > 0.0): + intralayer = None + if model.coupling is not None: + share = np.full(total.shape, spec.mu_core_filler) + interlayer = spec.mu_core_filler * filler + spec.mu_core_sheath * sheath + share[positive] = interlayer[positive] / total[positive] + reference_mu = float(model.coupling.interlayer_mu) + intralayer = np.asarray( + model.n_cores * core_core / (2.0 * math.pi * model.r_offset_m), + dtype=np.float64, + ) + if reference_mu <= 0.0 and np.any(share[positive] > 0.0): # A zero reference coefficient cannot carry the friction of later # samples: normalise by the coefficient of the most loaded sample. - reference_mu = float(mu[int(np.argmax(total))]) - if np.any(np.abs(mu - reference_mu) > 1e-12 * max(reference_mu, 1e-300)): + reference_mu = float(share[int(np.argmax(total))]) + if np.any(np.abs(share - reference_mu) > 1e-12 * max(reference_mu, 1e-300)): # The full-slip friction moment of the population at each sample's # coefficient over that at the normalising coefficient (positive # here unless every sample is frictionless). reference = _population_cap_per_pressure(population, reference_mu) - values, inverse = np.unique(mu, return_inverse=True) + values, inverse = np.unique(share, return_inverse=True) ratio = np.array( [ _population_cap_per_pressure(population, float(value)) / reference @@ -1088,6 +1201,7 @@ def follow(name: str) -> FloatArray: filler_profile_N_per_m=profile, filler_pressure_Pa=profile_pressure, core_mu_capstan=reference_mu, + core_intralayer_pressure_Pa=intralayer, ) @@ -1121,6 +1235,126 @@ def moment_Nm(self) -> FloatArray: return np.asarray(total) +def core_station_history( + model: CoreFrictionModel, + kappa_x: FloatArray, + kappa_y: FloatArray, + *, + initial_bending_angle: float = 0.0, + keep_cap: bool = False, +) -> WireSlipHistory: + """Direction-tied history of the core stations of ``model`` at its + reference loads: :func:`~cablexsec.mechanics.papailiou.wire_slip_history` + of the core population, with the coupled station groups of + ``core_core_coupling="relative"`` (module notes).""" + return wire_slip_history( + model.population, + kappa_x, + kappa_y, + initial_bending_angle=initial_bending_angle, + direction_hold_fraction=model.spec.direction_hold_fraction, + keep_cap=keep_cap, + coupling=model.coupling, + ) + + +def core_station_bounds( + model: CoreFrictionModel, phi_bend: float +) -> tuple[FloatArray, FloatArray]: + """Rising and falling friction-stress bounds of every core station [Pa] + for the bending direction ``phi_bend``: those of + :func:`~cablexsec.mechanics.papailiou.wire_slip_stress_bounds` (absolute + law), or the interlayer bounds plus the intralayer bound of the relative + coupling (the bound a station holds in full slip).""" + if model.coupling is None: + return wire_slip_stress_bounds(model.population, phi_bend) + upper, lower, cap = coupled_slip_stress_bounds( + model.population, model.coupling, phi_bend + ) + return np.asarray(upper + cap), np.asarray(lower + cap) + + +def core_full_slip_moment(model: CoreFrictionModel) -> float: + """Planar full-slip friction moment of the core population [N m]: every + station on the bound of its side (:func:`core_station_bounds`) under a + large curvature about ``phi_bend = 0``. The coupled stations of the + relative law hold the same bounds in full slip, whose intralayer shares + cancel in every group.""" + population = model.population + upper, lower = core_station_bounds(model, 0.0) + c = np.cos(population.phi_wires) + bound = np.where(c > 0.0, upper, lower) + return float( + population.A_wire_m2 + * math.cos(population.lay_angle_rad) + * population.r_helix_m + * np.sum(bound * np.abs(c)) + ) + + +#: Curvature samples of the monotonic path of :func:`core_full_slip_curvature` +#: (relative coupling) and bisections of its last interval. +_FULL_SLIP_SAMPLES = 2000 +_FULL_SLIP_BISECTIONS = 40 + + +def core_full_slip_curvature(model: CoreFrictionModel, phi_bend: float = 0.0) -> float: + """Curvature at which the last core station starts to slip [1/m]. + + Absolute law: :func:`~cablexsec.mechanics.papailiou.full_slip_curvature` + of the core population. Relative coupling: the stations of a group + redistribute their stress, so the point depends on the path; it is the + first curvature of a monotonic planar path from the stress-free state + (``phi_bend``, 2000 equal increments up to the value of independent + stations with the same bounds, refined by bisection of the last + increment) at which + every loaded station is on its bound. Zero without friction. + """ + population = model.population + if model.coupling is None: + return full_slip_curvature(population, phi_bend=phi_bend) + if not math.isfinite(phi_bend): + raise CableInputError("bending direction must be finite") + upper, lower, cap = coupled_slip_stress_bounds(population, model.coupling, phi_bend) + cosine = np.cos(population.phi_wires - phi_bend) + bound = np.where(cosine >= 0.0, upper, lower) + cap + loaded = np.abs(cosine) > 1.0e-12 + unit = population.k_f * population.r_helix_m * cosine + if not np.any(loaded) or not np.any(bound > 0.0): + return 0.0 + # Every station on its own bound: the independent-station value, the + # first bracket (doubled while the coupled stations stick beyond it). + top = float(np.max(bound[loaded] / np.abs(unit[loaded]))) + n = model.coupling.group_size + + def project(stress: FloatArray, step: float) -> FloatArray: + return project_station_groups(stress + step * unit, upper, lower, cap, n) + + def slipping(stress: FloatArray) -> bool: + side = np.abs(stress[loaded]) >= bound[loaded] * (1.0 - 1.0e-12) + return bool(np.all(side)) + + for _ in range(4): + steps = np.linspace(0.0, top, _FULL_SLIP_SAMPLES + 1) + stress = np.zeros_like(unit) + for k0, k1 in zip(steps[:-1], steps[1:], strict=True): + trial = project(stress, k1 - k0) + if slipping(trial): + lo, hi = float(k0), float(k1) + for _ in range(_FULL_SLIP_BISECTIONS): + mid = 0.5 * (lo + hi) + if slipping(project(stress, mid - k0)): + hi = mid + else: + lo = mid + return hi + stress = trial + top *= 2.0 # pragma: no cover - the first bracket held in every case + raise CableInputError( # pragma: no cover + "the coupled core stations did not reach full slip" + ) + + def _strand_history( model: CoreFrictionModel, kx: FloatArray, @@ -1177,6 +1411,18 @@ def _resolve_core_model( and curvature_path_out_of_plane_ratio(kx, ky) <= PLANAR_PATH_TOLERANCE ): return "direction_tied" + if model.coupling is not None: + reason = ( + "the relative core-core coupling (core_core_coupling='relative') " + "is a direction-tied law" + ) + if friction_model == "distributed": + raise CableInputError( + f"the distributed core law is not available: {reason}; use " + "friction_model='direction_tied' or core_core_coupling='absolute'" + ) + _warn_auto_fallback("the laid-core law", reason, stacklevel + 1) + return "direction_tied" rigid = [ f"the {name} (xi = {pop.xi:.6g})" for name, pop in zip( @@ -1255,7 +1501,12 @@ def core_friction_history( station) and substeps of at most ``max_increment`` slip-onset curvatures (the default of the distributed model), ``"auto"`` the direction-tied law on a planar path and the distributed law otherwise. The rings use - :func:`strand_slip_strain`. + :func:`strand_slip_strain`. A model with + ``core_core_coupling="relative"`` takes the coupled station groups of + :func:`~cablexsec.mechanics.papailiou.wire_slip_history` (direction-tied + only: ``"distributed"`` raises, ``"auto"`` keeps the direction-tied law + with a :class:`~cablexsec.provenance.FrictionModelFallbackWarning` on a + non-planar path); its load history must come from the same model. ``loads`` (:func:`core_load_history`, one sample per curvature sample) makes the contact loads follow a tension history; ``None`` holds the model's reference loads. All return moments in the material frame of the @@ -1280,7 +1531,26 @@ def core_friction_history( filler_pressure = loads.filler_pressure_Pa tension = loads.tension_N population = model.population - if ( + coupling = model.coupling + intralayer: FloatArray | None = None + if loads is not None and ( + (loads.core_intralayer_pressure_Pa is None) != (coupling is None) + ): + raise CableInputError( + "the core load history belongs to another core model " + "(its core-core coupling differs)" + ) + if coupling is not None: + if loads is not None: + intralayer = loads.core_intralayer_pressure_Pa + if ( + loads.core_mu_capstan is not None + and loads.core_mu_capstan != coupling.interlayer_mu + ): + coupling = dataclasses.replace( + coupling, interlayer_mu=loads.core_mu_capstan + ) + elif ( loads is not None and loads.core_mu_capstan is not None and loads.core_mu_capstan != population.mu @@ -1302,6 +1572,8 @@ def core_friction_history( contact_pressure_Pa=core_pressure, initial_bending_angle=initial_bending_angle, direction_hold_fraction=model.spec.direction_hold_fraction, + coupling=coupling, + intralayer_pressure_Pa=intralayer, ) core_moment, w = np.asarray(history.moment_Nm), history.work slip = history.slipping_count / float(model.population.n_wires) diff --git a/src/cablexsec/mechanics/core_kinematics.py b/src/cablexsec/mechanics/core_kinematics.py index c21a79f..2b56eb7 100644 --- a/src/cablexsec/mechanics/core_kinematics.py +++ b/src/cablexsec/mechanics/core_kinematics.py @@ -18,12 +18,15 @@ ``theta = pi/2`` along the lay circle in the direction of increasing ``phi``) and ``g_r``, ``g_t`` are the strain gradients of the core's own bending: the two Lutchansky components of the helical core axis, -``g_r = cos^2(beta) cos(2 beta) kappa_r`` and +``g_r = cos^2(beta) cos(2 beta) kappa_r + (sin^2(beta) / r_c) epsilon_b`` and ``g_t = cos(beta) (1 + sin^2 beta) kappa_t`` (:func:`cablexsec.mechanics.core_lay.core_bending_components`, after -[MenardCartraud2023] Eq. 14). The core curvature follows the cable curvature -in every state; the slip state sets only the core-axis strain -``epsilon_c``: +[MenardCartraud2023] Eq. 14), where ``epsilon_b`` is the bending part of the +core-axis strain (the normal curvature of a helical rod follows its axial +slip state, :func:`cablexsec.mechanics.wire_stress.slip_state_normal_curvature`: +``g_r = cos^4(beta) kappa_r`` stuck, ``cos^2(beta) cos(2 beta) kappa_r`` +free). The slip state sets the core-axis strain ``epsilon_c`` and, through +it, the normal core curvature: ``"stuck"`` Plane-section bound: the core is bonded to the cable cross-section, @@ -79,11 +82,12 @@ CoreFrictionSpec, _core_geometry, build_core_friction, + core_station_history, ) from cablexsec.mechanics.core_lay import core_angle -from cablexsec.mechanics.papailiou import wire_slip_history from cablexsec.mechanics.radial_cable import CableRadialState from cablexsec.mechanics.section_state import SectionState +from cablexsec.mechanics.wire_stress import slip_state_normal_curvature __all__ = [ "CORE_SLIP_STATES", @@ -269,12 +273,8 @@ def core_kinematics( "the frictional state uses n_cores * n_stations_per_core stations " f"({population.n_wires}); set CoreFrictionSpec.n_stations_per_core" ) - history = wire_slip_history( - population, - kx, - ky, - initial_bending_angle=initial_bending_angle, - direction_hold_fraction=spec.direction_hold_fraction, + history = core_station_history( + model, kx, ky, initial_bending_angle=initial_bending_angle ) phase = np.asarray(population.phi_wires, dtype=np.float64) axis = np.asarray(history.stress_Pa / population.E_wire_Pa) @@ -312,6 +312,9 @@ def core_kinematics( else: axis = np.zeros((count, kx.size)) xi = 0.0 + # The normal curvature of the core follows its slip state through the + # bending part of the core-axis strain (before the axial strain is added). + held = slip_state_normal_curvature(axis, 1.0, beta, r_c) if r_c > 0.0 else 0.0 if eps_axial is not None: axis = axis + math.cos(beta) ** 2 * eps_axial[None, :] c, s = math.cos(beta), math.sin(beta) @@ -324,7 +327,7 @@ def core_kinematics( lay_angle_rad=beta, phase_rad=phase, axis_strain=np.asarray(axis, dtype=np.float64), - gradient_radial_per_m=np.asarray(c * c * math.cos(2.0 * beta) * kr), + gradient_radial_per_m=np.asarray(c * c * math.cos(2.0 * beta) * kr + held), gradient_tangential_per_m=np.asarray(c * (1.0 + s * s) * kt), xi=xi, slipping=slipping, diff --git a/src/cablexsec/mechanics/core_lay.py b/src/cablexsec/mechanics/core_lay.py index 1a8119c..1db762f 100644 --- a/src/cablexsec/mechanics/core_lay.py +++ b/src/cablexsec/mechanics/core_lay.py @@ -41,7 +41,12 @@ def core_bending_components( The azimuth is measured from the positive extension side of kx, as in the global core-axis strain. Ménard and Cartraud (2023), Eq. (14), use an azimuth measured from the bending axis instead. Its second coefficient - is cos²(angle)*cos(2*angle), not cos⁴(angle). + is cos²(angle)*cos(2*angle), the curve curvature of the deformed helix: + the normal curvature of a core that carries no bending axial strain + (free). The slip state adds ``(sin²(angle) / r_c) epsilon_b`` of the + bending part of the core-axis strain + (:func:`~cablexsec.mechanics.wire_stress.slip_state_normal_curvature`), + which makes a stuck core ``cos⁴(angle)``; the callers add it. """ c, s = math.cos(angle), math.sin(angle) radial = kx * math.cos(phase) + ky * math.sin(phase) diff --git a/src/cablexsec/mechanics/papailiou.py b/src/cablexsec/mechanics/papailiou.py index e14fa93..894f99c 100644 --- a/src/cablexsec/mechanics/papailiou.py +++ b/src/cablexsec/mechanics/papailiou.py @@ -103,6 +103,10 @@ ) from cablexsec.mechanics.mkappa import HelicalLayerSpec from cablexsec.mechanics.return_mapping import CoulombElement +from cablexsec.mechanics.station_coupling import ( + StationCoupling, + project_station_groups, +) if TYPE_CHECKING: from cablexsec.mechanics.progressive_friction import ProgressiveFriction @@ -114,7 +118,9 @@ "compute_mkappa_papailiou", "DIRECTION_HOLD_FRACTION", "compute_mkappa_wire_slip_front", + "coupled_slip_stress_bounds", "direction_threshold_curvature", + "elastic_only_history", "full_slip_curvature", "slip_onset_curvature", "wire_slip_stress_bounds", @@ -123,6 +129,8 @@ ] FloatArray = NDArray[np.float64] +#: Interlayer upper, lower and intralayer bounds of coupled stations. +_Bounds3 = tuple[FloatArray, FloatArray, FloatArray] #: Default fraction ``f`` of the smallest slip-onset curvature below which the #: bending direction of the slip cap is held and blended (see @@ -425,6 +433,81 @@ def wire_slip_stress_bounds( _UNREACHABLE_CAP_PA = 1.0e300 +def coupled_slip_stress_bounds( + layer: HelicalLayerSpec, + coupling: StationCoupling, + phi_bend: float, + *, + contact_pressure_Pa: float | None = None, + intralayer_pressure_Pa: float | None = None, +) -> tuple[FloatArray, FloatArray, FloatArray]: + r"""Interlayer and intralayer bounds of coupled stations [Pa]. + + Returns ``(upper, lower, cap)``: the interlayer bounds of + :func:`wire_slip_stress_bounds` with the coupling's interlayer coefficient + at ``contact_pressure_Pa`` (default the layer's), and the intralayer bound + + .. math:: + + C = \sigma_0(P_c) \, \mu_{cc} |\sin a| \, g \min(\psi, \pi / n), + + with ``sigma_0`` of :func:`wire_slip_stress_cap` at the intralayer + pressure ``P_c`` (default the coupling's) and ``psi`` the angle of the + station from the neutral axis + (:mod:`cablexsec.mechanics.station_coupling`). + """ + interlayer = dataclasses.replace(layer, mu=coupling.interlayer_mu) + upper, lower = wire_slip_stress_bounds( + interlayer, phi_bend, contact_pressure_Pa=contact_pressure_Pa + ) + pressure = ( + coupling.intralayer_pressure_Pa + if intralayer_pressure_Pa is None + else intralayer_pressure_Pa + ) + sin_a = abs(math.sin(layer.lay_angle_rad)) + if pressure <= 0.0 or sin_a < 1.0e-12 or coupling.intralayer_mu <= 0.0: + return upper, lower, np.zeros(layer.n_wires, dtype=np.float64) + width = 2.0 * math.pi * layer.r_helix_m / layer.n_wires + rate = ( + layer.r_helix_m + * pressure + * width + * math.cos(layer.lay_angle_rad) + * coupling.intralayer_mu + / (layer.A_wire_m2 * sin_a) + ) + g = ( + np.ones(layer.n_wires, dtype=np.float64) + if layer.shape_g is None + else np.asarray(layer.shape_g, dtype=np.float64) + ) + cphi = np.cos(layer.phi_wires - phi_bend) + psi = np.arcsin(np.clip(np.abs(cphi), 0.0, 1.0)) + cap = rate * g * np.minimum(psi, coupling.plateau_rad) + return upper, lower, np.asarray(cap, dtype=np.float64) + + +def _coupled_threshold_coefficient( + layer: HelicalLayerSpec, coupling: StationCoupling, hold_fraction: float +) -> tuple[float, float]: + """Direction-threshold coefficients of the interlayer pressure and of the + intralayer pressure (the threshold is ``(c_a P + c_c P_c) / k``).""" + interlayer = dataclasses.replace(layer, mu=coupling.interlayer_mu) + coefficient_a = _threshold_coefficient(interlayer, hold_fraction) + if hold_fraction == 0.0: + return coefficient_a, 0.0 + g_min = 1.0 if layer.shape_g is None else float(np.min(layer.shape_g)) + lam = coupling.interlayer_mu * abs(math.sin(layer.lay_angle_rad)) + intralayer = dataclasses.replace(layer, mu=coupling.intralayer_mu) + coefficient_c = ( + hold_fraction + * _compression_onset_factor(lam) + * _onset_coefficient(intralayer, max(g_min, 0.0)) + ) + return coefficient_a, coefficient_c + + def slip_onset_curvature( layer: HelicalLayerSpec, *, @@ -741,6 +824,31 @@ class WireSlipHistory: cap_Pa: FloatArray | None = None +def _partly_zero(stiffness: FloatArray) -> bool: + """True if some but not all samples of a stick stiffness are zero.""" + zero = stiffness == 0.0 + return bool(np.any(zero) and not np.all(zero)) + + +def elastic_only_history(n_wires: int, count: int) -> WireSlipHistory: + """History of a wire population whose slider has zero stick stiffness. + + Such a slider never carries stress, so it neither slips nor dissipates: + zero stress, moment and work, every wire stuck. It arises for a bonded + outer face (``bonded_face="outer"``, gap G8) at a zero lay angle, where + the bond carries the whole layer and ``xi_slider = 0``. + """ + zeros = np.zeros(count) + return WireSlipHistory( + np.zeros((n_wires, count)), + np.zeros((count, 2)), + np.zeros(count, dtype=np.int64), + np.zeros(n_wires), + zeros.copy(), + BendingWork(zeros.copy(), zeros.copy(), zeros.copy(), zeros.copy(), zeros), + ) + + def wire_slip_history( layer: HelicalLayerSpec, kappa_x: FloatArray, @@ -753,9 +861,23 @@ def wire_slip_history( keep_cap: bool = False, friction_law: FrictionLaw | None = None, time_s: FloatArray | None = None, + coupling: StationCoupling | None = None, + intralayer_pressure_Pa: FloatArray | None = None, ) -> WireSlipHistory: """Shared small-strain, mean-clamping update for bending and bulk fatigue. + Coupled stations. ``coupling`` + (:class:`~cablexsec.mechanics.station_coupling.StationCoupling`) makes the + stations of one axial position a group with the interlayer and intralayer + bounds of :func:`coupled_slip_stress_bounds` and the group return map of + :func:`~cablexsec.mechanics.station_coupling.project_station_groups` + (the laid cores with ``core_core_coupling="relative"``); the direction + hold below blends the three bounds alike, ``contact_pressure_Pa`` is then + the pressure of the interlayer bounds and ``intralayer_pressure_Pa`` that + of the intralayer bound (default the coupling's). ``keep_cap`` returns the + station bound ``upper + cap`` or ``lower + cap``. It takes no friction + law. ``None`` keeps the independent stations, bit for bit. + No spatial contact solve is introduced. The Papailiou bounds of :func:`wire_slip_stress_bounds` and a scalar spring-slider describe each physical wire: its friction stress stays in ``[-lower, upper]``. Their @@ -890,10 +1012,36 @@ def wire_slip_history( raise CableInputError( f"{label} must be finite and match curvature histories" ) - if np.any(pressure < 0) or np.any(stiffness <= 0): + if np.any(pressure < 0) or np.any(stiffness < 0) or _partly_zero(stiffness): raise CableInputError( "nonnegative pressure and positive stiffness are required" ) + if not np.any(stiffness): + if coupling is not None or keep_cap: + raise CableInputError( + "a zero stick stiffness (an elastic-only layer) is implemented " + "for the bending law only" + ) + return elastic_only_history(layer.n_wires, count) + if coupling is not None: + if law is not None: + raise CableInputError( + "coupled stations (relative core-core slip) take no friction law" + ) + return _coupled_wire_slip_history( + layer, + coupling, + kx, + ky, + pressure, + intralayer_pressure_Pa, + stiffness, + initial_bending_angle, + float(direction_hold_fraction), + keep_cap, + ) + if intralayer_pressure_Pa is not None: + raise CableInputError("an intralayer pressure needs a station coupling") if law is not None: return _law_wire_slip_history( layer, @@ -1046,6 +1194,171 @@ def oriented_cap( ) +def _coupled_wire_slip_history( + layer: HelicalLayerSpec, + coupling: StationCoupling, + kx: FloatArray, + ky: FloatArray, + pressure: FloatArray, + intralayer_pressure_Pa: FloatArray | None, + stiffness: FloatArray, + initial_bending_angle: float, + hold_fraction: float, + keep_cap: bool, +) -> WireSlipHistory: + """:func:`wire_slip_history` of coupled station groups (validated inputs). + + The same update as the independent stations with the three bounds of + :func:`coupled_slip_stress_bounds` and the group return map; the work + terms are those of the independent stations (the plastic work of each + group update is non-negative). + """ + count = kx.size + if layer.n_wires % coupling.group_size: + raise CableInputError( + f"{layer.n_wires} stations do not form groups of " + f"{coupling.group_size} cores" + ) + intralayer = ( + np.full(count, coupling.intralayer_pressure_Pa) + if intralayer_pressure_Pa is None + else np.asarray(intralayer_pressure_Pa, dtype=float) + ) + if intralayer.shape != kx.shape or not np.isfinite(intralayer).all(): + raise CableInputError( + "intralayer pressure must be finite and match curvature histories" + ) + if np.any(intralayer < 0): + raise CableInputError("nonnegative intralayer pressure is required") + coefficient_a, coefficient_c = _coupled_threshold_coefficient( + layer, coupling, hold_fraction + ) + element = CoulombElement(k=float(stiffness[0]), shape=(layer.n_wires,)) + directions = np.column_stack((np.cos(layer.phi_wires), np.sin(layer.phi_wires))) + drive_map = layer.r_helix_m * directions + weight = layer.A_wire_m2 * math.cos(layer.lay_angle_rad) + stress = np.empty((layer.n_wires, count)) + caps = np.empty((layer.n_wires, count)) if keep_cap else None + moment = np.empty((count, 2)) + slipping_count = np.empty(count, dtype=np.int64) + stored, friction, endpoint, remainder, material = ( + np.zeros(count) for _ in range(5) + ) + totals = np.zeros(4) + old_drive = np.zeros(layer.n_wires) + held = current = initial_bending_angle + zero = np.zeros(layer.n_wires) + + caches: dict[str, tuple[tuple[float, float, float] | None, _Bounds3]] = { + "held": (None, (zero, zero, zero)), + "current": (None, (zero, zero, zero)), + } + + def oriented(slot: str, angle: float, load: float, load_c: float) -> _Bounds3: + key, value = caches[slot] + if key != (angle, load, load_c): + value = coupled_slip_stress_bounds( + layer, + coupling, + angle, + contact_pressure_Pa=load, + intralayer_pressure_Pa=load_c, + ) + for part in value: + if ( + part.shape != (layer.n_wires,) + or not np.isfinite(part).all() + or np.any(part < 0) + ): + raise CableInputError( + "wire caps must be finite, nonnegative and match the population" + ) + caches[slot] = ((angle, load, load_c), value) + return value + + with np.errstate(over="raise", invalid="raise", divide="raise"): + try: + for index, (x, y) in enumerate(zip(kx, ky, strict=True)): + current_stiffness = float(stiffness[index]) + if current_stiffness != element.k: + elastic_strain = element.f / element.k + totals[3] += ( + 0.5 + * weight + * (current_stiffness - element.k) + * (elastic_strain**2).sum() + ) + element.set_stiffness(current_stiffness) + old_stress, old_plastic = element.f, element.slip_total + load = float(pressure[index]) + load_c = float(intralayer[index]) + if x != 0 or y != 0: + current = math.atan2(y, x) + threshold = ( + coefficient_a * load + coefficient_c * load_c + ) / current_stiffness + magnitude = math.sqrt(x * x + y * y) + if magnitude >= threshold: + held = current + upper, lower, cap = oriented("held", held, load, load_c) + else: + blend = magnitude / threshold + upper, lower, cap = oriented("held", held, load, load_c) + if blend > 0.0: + now = oriented("current", current, load, load_c) + upper = (1.0 - blend) * upper + blend * now[0] + lower = (1.0 - blend) * lower + blend * now[1] + cap = (1.0 - blend) * cap + blend * now[2] + drive = drive_map @ np.array([x, y]) + increment = drive - old_drive + if not np.isfinite(increment).all(): + raise CableInputError("derived wire increment must be finite") + trial = element.f + element.k * increment + force = project_station_groups( + trial, upper, lower, cap, coupling.group_size + ) + slipping = force != trial + slip = np.where( + slipping, increment - (force - element.f) / element.k, 0.0 + ) + element.f = force + element.slip_total = element.slip_total + slip + stress[:, index] = force + if caps is not None: + caps[:, index] = np.where(force < 0.0, lower, upper) + cap + moment[index] = weight * (force @ drive_map) + slipping_count[index] = np.count_nonzero(slipping) + stored[index] = weight * (force**2).sum() / (2 * current_stiffness) + totals[0] += weight * (force * (element.slip_total - old_plastic)).sum() + totals[1] += weight * (force * increment).sum() + totals[2] += ( + weight * ((force - old_stress) ** 2).sum() / (2 * current_stiffness) + ) + friction[index], endpoint[index], remainder[index], material[index] = ( + totals + ) + old_drive = drive + balance = endpoint + material - stored - friction - remainder + except FloatingPointError as error: + raise CableInputError( + "wire history exceeds floating-point range" + ) from error + if not all( + np.isfinite(v).all() + for v in (stress, moment, element.slip_total, stored, friction, balance) + ): + raise CableInputError("wire history produced nonfinite results") + return WireSlipHistory( + stress, + moment, + slipping_count, + element.slip_total.copy(), + material, + BendingWork(stored, friction, endpoint, remainder, balance), + caps, + ) + + def _law_threshold_layer(layer: HelicalLayerSpec, law: FrictionLaw) -> HelicalLayerSpec: """Layer with the smallest coefficient of the law (direction threshold; the smallest pressure factor included).""" diff --git a/src/cablexsec/mechanics/progressive_friction.py b/src/cablexsec/mechanics/progressive_friction.py index 02d8c10..509979c 100644 --- a/src/cablexsec/mechanics/progressive_friction.py +++ b/src/cablexsec/mechanics/progressive_friction.py @@ -81,7 +81,9 @@ DIRECTION_HOLD_FRACTION, BendingWork, WireSlipHistory, + _partly_zero, _threshold_coefficient, + elastic_only_history, ) if TYPE_CHECKING: @@ -337,10 +339,23 @@ def progressive_wire_history( raise CableInputError( f"{label} must be finite and match curvature histories" ) - if np.any(pressure < 0) or np.any(stiffness <= 0): + if np.any(pressure < 0) or np.any(stiffness < 0) or _partly_zero(stiffness): raise CableInputError( "nonnegative pressure and positive stiffness are required" ) + if not np.any(stiffness): + # elastic-only layer (zero stick stiffness): no stress, slip or work + base = elastic_only_history(layer.n_wires, count) + return ProgressiveWireHistory( + base.stress_Pa, + base.moment_Nm, + base.slipping_count, + base.final_plastic_drive, + base.material_work_J_per_m, + base.work, + slipping_share=np.zeros(count), + settings=spec, + ) n_el = spec.n_elements share = 1.0 / n_el n_w = layer.n_wires diff --git a/src/cablexsec/mechanics/station_coupling.py b/src/cablexsec/mechanics/station_coupling.py new file mode 100644 index 0000000..3248a15 --- /dev/null +++ b/src/cablexsec/mechanics/station_coupling.py @@ -0,0 +1,279 @@ +# SPDX-License-Identifier: Apache-2.0 +# Copyright (c) 2026 Jae Hoon Seo, SMI Lab, Inha University +r"""Coupled spring--slider stations of laid cores (relative intralayer slip). + +Used by :func:`cablexsec.mechanics.papailiou.wire_slip_history` when the +laid-core law takes ``CoreFrictionSpec(core_core_coupling="relative")`` +(:mod:`cablexsec.mechanics.core_friction`). Neighbouring cores of one layer +touch at the same axial position, and the friction between them acts on their +relative slip, so the stations of the core population that sit at one axial +position are not independent. + +Groups +------ +A population of ``K = n G`` stations at azimuths ``2 pi k / K`` stands for +``n`` cores; the ``n`` stations ``g, g + G, ..., g + (n - 1) G`` (azimuths +``2 pi / n`` apart) are the cores at one axial position, group ``g``. + +Bounds +------ +The friction stress of a station is the sum ``sigma = a + c`` of the friction +accumulated from the neutral axis over its interlayer contacts (filler, +bedding, sheath; the absolute slip of the core) and over its intralayer +contacts (the neighbouring cores; their relative slip): + +* ``-L <= a <= U``, the direction-tied bounds of the interlayer share (the + capstan form of :func:`~cablexsec.mechanics.papailiou.wire_slip_stress_bounds` + with the interlayer coefficient); +* ``-C <= c <= C``, ``C = sigma_0 mu_cc |sin b| g min(psi, pi / n)`` (constant + Coulomb bound of the core--core load, ``psi`` the angle of the station from + the neutral axis): the planar full-slip profile of the coupled law, whose + intralayer share grows at the full rate only over ``psi < pi / n``, where a + core slips against both neighbours in the same sense, and stays flat beyond, + where the two neighbours pull in opposite senses; +* ``c_g + c_{g+G} + ... = 0`` in every group: the friction between two + neighbours is an action and a reaction, so the intralayer shares of the + cores at one axial position cancel. + +The admissible set of a group is the Minkowski sum ``A + (B ∩ H)`` (``A`` the +interlayer box, ``B`` the intralayer box, ``H`` the zero-sum plane). Without +intralayer friction it is the box ``A`` and the return map is the clip of the +uncoupled law. + +Return map +---------- +The stations have equal stick stiffness, so the return map of a group is the +Euclidean closest point of the trial stress ``t`` on the admissible set. With +a multiplier ``nu`` of the zero-sum constraint, every station has the closed +form ``c = clip(t - U - nu, -C, C)`` for ``nu > 0`` and +``c = clip(t + L - nu, -C, C)`` for ``nu < 0``, then ``a = clip(t - c, -L, +U)``; ``nu = 0`` (the box clip ``clip(t, -(L + C), U + C)``) holds when +``sum clip(t - U, -C, C) <= 0 <= sum clip(t + L, -C, C)`` (to a round-off +margin of 1e-13 of the group's stress magnitudes, so that a group in stick +stays in stick exactly). Otherwise ``nu`` +is the root of the piecewise-linear, monotone ``sum c(nu) = 0``, found exactly +from its sorted breakpoints. The stress ``a + c`` is unique. The plastic work +of every update is non-negative (the set contains zero). + +Two implementations solve the same update: a NumPy path vectorised over the +groups and a compiled kernel (numba); they agree to round-off +(tests/test_core_coupled_slip.py). +""" + +from __future__ import annotations + +import math +from dataclasses import dataclass + +import numpy as np +from numpy.typing import NDArray + +from cablexsec._numba import HAVE_NUMBA, njit +from cablexsec.exceptions import CableInputError + +__all__ = [ + "StationCoupling", + "group_view", + "project_station_groups", +] + +FloatArray = NDArray[np.float64] + +#: Relative size of a zero-sum residual taken as round-off: a group whose box +#: clip leaves its intralayer shares out of balance by less than this times +#: the sum of its stress magnitudes keeps the box clip (stick stays stick). +_ROUND_OFF = 1.0e-13 + + +@dataclass(frozen=True) +class StationCoupling: + """Coupled groups of a station population (module notes). + + ``group_size`` is the number of cores ``n`` (stations per group), + ``interlayer_mu`` the load-weighted coefficient of the interlayer contacts + over the total core load (the capstan bound of the interlayer share takes + it with the total contact pressure), ``intralayer_mu`` the core--core + coefficient and ``intralayer_pressure_Pa`` the pressure equivalent + ``n q_cc / (2 pi r_c)`` of the core--core line load ``q_cc``. + """ + + group_size: int + interlayer_mu: float + intralayer_mu: float + intralayer_pressure_Pa: float + + def __post_init__(self) -> None: + n = self.group_size + if isinstance(n, bool) or not isinstance(n, int) or n < 2: + raise CableInputError("the coupled group size must be an integer >= 2") + for name in ("interlayer_mu", "intralayer_mu", "intralayer_pressure_Pa"): + value = getattr(self, name) + if not math.isfinite(value) or value < 0.0: + raise CableInputError(f"{name} must be finite and non-negative") + + @property + def plateau_rad(self) -> float: + """Angle from the neutral axis beyond which ``C`` is flat, ``pi / n``.""" + return math.pi / self.group_size + + +def group_view(values: FloatArray, group_size: int) -> FloatArray: + """Station values ``(K,)`` as groups ``(G, n)``: row ``g`` holds stations + ``g, g + G, ..., g + (n - 1) G`` (a view, no copy).""" + count = values.shape[0] + if count % group_size: + raise CableInputError( + f"{count} stations do not form groups of {group_size} cores" + ) + return values.reshape(group_size, count // group_size).T + + +def _root_numpy(d: FloatArray, cap: FloatArray) -> FloatArray: + """``nu > 0`` with ``sum clip(d - nu, -cap, cap) = 0`` row by row, for rows + whose sum at ``nu = 0`` is positive (so ``sum cap > 0``).""" + points = np.sort(np.concatenate((d - cap, d + cap), axis=1), axis=1) + values = np.sum( + np.clip(d[:, None, :] - points[:, :, None], -cap[:, None, :], cap[:, None, :]), + axis=2, + ) + # Non-increasing along the breakpoints, sum(cap) > 0 at the first and + # -sum(cap) < 0 at the last: the root lies after the last positive value. + upper = np.argmax(values <= 0.0, axis=1) + rows = np.arange(d.shape[0]) + x0, x1 = points[rows, upper - 1], points[rows, upper] + f0, f1 = values[rows, upper - 1], values[rows, upper] + return np.asarray(x0 + f0 * (x1 - x0) / (f0 - f1), dtype=np.float64) + + +def _project_numpy( + trial: FloatArray, upper: FloatArray, lower: FloatArray, cap: FloatArray +) -> FloatArray: + """NumPy path of :func:`project_station_groups` on ``(G, n)`` arrays.""" + out = np.clip(trial, -(lower + cap), upper + cap) + margin = _ROUND_OFF * np.sum(np.abs(trial) + upper + lower + cap, axis=1) + rising = np.sum(np.clip(trial - upper, -cap, cap), axis=1) > margin + falling = np.sum(np.clip(trial + lower, -cap, cap), axis=1) < -margin + for rows, sign in ((rising, 1.0), (falling, -1.0)): + if not np.any(rows): + continue + t, u, lo, c = trial[rows], upper[rows], lower[rows], cap[rows] + # Falling: the mirrored problem on -(t + L) has the same root form. + d = t - u if sign > 0.0 else -(t + lo) + nu = _root_numpy(d, c) + share = sign * np.clip(d - nu[:, None], -c, c) + out[rows] = np.clip(t - share, -lo, u) + share + return np.asarray(out, dtype=np.float64) + + +@njit(cache=True) +def _root_kernel(d: FloatArray, cap: FloatArray, points: FloatArray) -> float: + n = d.size + for i in range(n): + points[i] = d[i] - cap[i] + points[n + i] = d[i] + cap[i] + m = 2 * n + for i in range(1, m): # insertion sort (n is the core count) + key = points[i] + j = i - 1 + while j >= 0 and points[j] > key: + points[j + 1] = points[j] + j -= 1 + points[j + 1] = key + previous_x = points[0] + previous_f = 0.0 + for i in range(n): + previous_f += cap[i] + for k in range(1, m): + x = points[k] + f = 0.0 + for i in range(n): + v = d[i] - x + if v > cap[i]: + v = cap[i] + elif v < -cap[i]: + v = -cap[i] + f += v + if f <= 0.0: + return float(previous_x + previous_f * (x - previous_x) / (previous_f - f)) + previous_x = x + previous_f = f + return float(points[m - 1]) # pragma: no cover - unreachable (sum(cap) > 0) + + +@njit(cache=True) +def _project_kernel( + trial: FloatArray, + upper: FloatArray, + lower: FloatArray, + cap: FloatArray, + out: FloatArray, +) -> None: + """Compiled path of :func:`project_station_groups` on ``(G, n)`` arrays.""" + groups, n = trial.shape + d = np.empty(n) + c = np.empty(n) + points = np.empty(2 * n) + for g in range(groups): + rising = 0.0 + falling = 0.0 + margin = 0.0 + for i in range(n): + ci = cap[g, i] + v = trial[g, i] - upper[g, i] + rising += min(max(v, -ci), ci) + w = trial[g, i] + lower[g, i] + falling += min(max(w, -ci), ci) + margin += abs(trial[g, i]) + upper[g, i] + lower[g, i] + ci + margin *= _ROUND_OFF + if rising > margin: + sign = 1.0 + elif falling < -margin: + sign = -1.0 + else: + for i in range(n): + hi = upper[g, i] + cap[g, i] + lo = -(lower[g, i] + cap[g, i]) + out[g, i] = min(max(trial[g, i], lo), hi) + continue + for i in range(n): + c[i] = cap[g, i] + if sign > 0.0: + d[i] = trial[g, i] - upper[g, i] + else: + d[i] = -(trial[g, i] + lower[g, i]) + nu = _root_kernel(d, c, points) + for i in range(n): + share = sign * min(max(d[i] - nu, -c[i]), c[i]) + a = min(max(trial[g, i] - share, -lower[g, i]), upper[g, i]) + out[g, i] = a + share + + +def project_station_groups( + trial: FloatArray, + upper: FloatArray, + lower: FloatArray, + cap: FloatArray, + group_size: int, + *, + compiled: bool | None = None, +) -> FloatArray: + """Return map of the coupled station groups (module notes). + + ``trial``, ``upper``, ``lower`` (interlayer bounds, magnitudes) and ``cap`` + (intralayer bound ``C``) are per station, shape ``(K,)``; the result is + the stress of every station. ``compiled`` selects the numba kernel + (default: when numba is active) or the NumPy path. + """ + arrays = [ + group_view(np.ascontiguousarray(x, dtype=np.float64), group_size) + for x in (trial, upper, lower, cap) + ] + use_kernel = HAVE_NUMBA if compiled is None else compiled + if use_kernel: + t, u, lo, c = (np.ascontiguousarray(x) for x in arrays) + out = np.empty_like(t) + _project_kernel(t, u, lo, c, out) + else: + out = _project_numpy(*arrays) + # Back to station order (row g, column j is station j G + g). + return np.ascontiguousarray(out.T).reshape(-1) diff --git a/src/cablexsec/mechanics/stick_support.py b/src/cablexsec/mechanics/stick_support.py index e6b95de..d61571a 100644 --- a/src/cablexsec/mechanics/stick_support.py +++ b/src/cablexsec/mechanics/stick_support.py @@ -48,6 +48,7 @@ __all__ = [ "SupportCondition", "annulus_mode1_compliance", + "annulus_mode1_compliance_inner", "strip_concentration_compliance", ] @@ -122,6 +123,54 @@ def annulus_mode1_compliance( return w / sigma +def annulus_mode1_compliance_inner( + layers: Sequence[tuple[float, float, float]], +) -> float: + """Inner-surface compliance ``w(r_i) / tau_z`` [m/Pa] with a free outer surface. + + The mode-1 antiplane problem of :func:`annulus_mode1_compliance`, loaded + on the INNER surface of the stack and free of shear stress on its outer + surface: the polymer outside a helical layer whose outer face is bonded to + it (a sheath extruded onto the wires). For one layer it is + ``r_i (r_i^2 + r_o^2) / (G (r_o^2 - r_i^2))``. + + Parameters + ---------- + layers : sequence of (r_inner, r_outer, G) + Layers from the inside out: radii [m], shear modulus [Pa]. A radial + gap between consecutive layers is rigid (it keeps the displacement and + the shear flow ``sigma r``); an overlap within the cable schema's + radial tolerance is a touching interface, a larger one is refused. + + Returns + ------- + float + Axial surface displacement amplitude per unit axial traction + amplitude at the inner radius; ``0`` for an empty stack. + """ + if not layers: + return 0.0 + seq = list(layers) + for r_in, r_out, g in seq: + if not (math.isfinite(r_in) and math.isfinite(r_out) and math.isfinite(g)): + raise ValueError("layer radii and shear modulus must be finite") + if r_out <= r_in or r_in <= 0.0 or g <= 0.0: + raise ValueError("each layer needs 0 < r_inner < r_outer and G > 0") + for (_, r_out_a, _), (r_in_b, _, _) in zip(seq[:-1], seq[1:], strict=True): + if r_out_a - r_in_b > _radial_tol(r_out_a): + raise ValueError("layers must not overlap") + # Free outer surface (w = 1, zero shear stress); carry the field inward. + w, sigma = 1.0, 0.0 + r_prev = seq[-1][1] + for r_in, r_out, g in reversed(seq): + r_out = min(r_out, r_prev) # a touching interface starts at r_prev + if r_out < r_prev: + sigma *= r_prev / r_out # rigid gap: shear flow sigma r is kept + w, sigma = _propagate(w, sigma, r_out, r_in, g) + r_prev = r_in + return abs(w / sigma) + + def strip_concentration_compliance( spacing_m: float, half_width_m: float, diff --git a/src/cablexsec/mechanics/stiffness.py b/src/cablexsec/mechanics/stiffness.py index e2b2b04..99c80d7 100644 --- a/src/cablexsec/mechanics/stiffness.py +++ b/src/cablexsec/mechanics/stiffness.py @@ -55,6 +55,7 @@ _radial_tol, is_serving, layer_stiffness, + uses_cable_materials, ) from cablexsec.exceptions import CableInputError from cablexsec.materials import library @@ -93,6 +94,11 @@ "require_stick_support", "xi_for_layer", "yun_shear_stack", + "BondedFaceTerms", + "bonded_face_stack", + "bonded_face_stiffness", + "bonded_face_terms", + "bonded_face_ei", "BendingStiffnessContribution", "bending_stiffness_by_layer", ] @@ -736,6 +742,202 @@ def xi_for_layer( return yun_xi(k_g, ea_w, layer.lay_angle_rad, layer.r_helix_m) +# --------------------------------------------------------------------------- # +# Bonded outer armour face (gap G8) # +# --------------------------------------------------------------------------- # +@dataclass(frozen=True) +class BondedFaceTerms: + """Terms of a helical layer whose outer face is bonded (``bonded_face="outer"``). + + Attributes + ---------- + stiffness_N_m2 : float + Per-wire, per-length stiffness ``K_b`` of the bond through the polymer + outside the wires [N/m²]. + xi_bond : float + ``K_b / (K_b + EA_w sin^2(a) / r_h^2)``: the elastic share the bond keeps + in full slip. + xi_slider : float + Stick coefficient left to the friction slider: ``xi_tot - xi_bond``, + with ``xi_tot`` the support and the bond in parallel. The stuck layer + is then unchanged, and full slip leaves exactly ``xi_bond``. + ei_bond_Nm2 : float + ``xi_bond * 1/2 n_w E_w A_w r_h^2 cos^3(a)``: the bond's bending + stiffness, elastic and history-free, in parallel with the law. + """ + + stiffness_N_m2: float + xi_bond: float + xi_slider: float + ei_bond_Nm2: float + + +@uses_cable_materials +def bonded_face_stack( + cable: CableData, layer_name: str +) -> tuple[CylindricalLayer, ...]: + """Polymer layers outside a helical layer with a bonded outer face (inside out). + + The layer must be the outermost helical layer, and a cylindrical layer + with an isotropic modulus must touch its wires; every cylindrical layer + outside it with a modulus and a positive thickness is in the stack, which + is free of shear stress at the cable surface. + """ + layer = cable.get_layer(layer_name) + if not isinstance(layer, HelicalLayer) or layer.r_helix_m is None: + raise CableInputError(f"{layer_name}: bonded_face needs a helical layer") + if any( + (h.r_helix_m or 0.0) > layer.r_helix_m + for h in cable.helical_layers + if h.name != layer.name + ): + raise CableInputError( + f"{layer_name}: bonded_face='outer' is implemented for the outermost " + "helical layer only" + ) + r_face = layer.r_helix_m + 0.5 * layer.wire_radial_thickness_m + stack = sorted( + ( + lyr + for lyr in cable.layers + if isinstance(lyr, CylindricalLayer) + and lyr.r_inner_m is not None + and lyr.r_outer_m is not None + and lyr.r_outer_m > lyr.r_inner_m + and lyr.r_inner_m >= r_face - _radial_tol(r_face) + and _has_modulus(lyr.material) + ), + key=lambda lyr: lyr.r_inner_m or 0.0, + ) + if not stack or (stack[0].r_inner_m or 0.0) - r_face > _radial_tol(r_face): + raise CableInputError( + f"{layer_name}: bonded_face='outer' needs a cylindrical polymer layer " + "on the wires (no gap)" + ) + return tuple(stack) + + +@uses_cable_materials +def bonded_face_stiffness( + cable: CableData, + layer_name: str, + *, + youngs_modulus_Pa: Mapping[str, float] | None = None, +) -> float: + """Per-wire bond stiffness ``K_b`` [N/m²] of a bonded outer face. + + The polymer outside the wires as a layered annulus loaded on its inner + surface and free at the cable surface + (:func:`~cablexsec.mechanics.stick_support.annulus_mode1_compliance_inner`), + with the axial and circumferential shares of the wire direction as in the + ``"annulus"`` stick support, spread over the wire spacing, plus the + concentration of the load on the wire's own width. + """ + from cablexsec.mechanics.stick_support import ( # noqa: PLC0415 + annulus_mode1_compliance_inner, + strip_concentration_compliance, + ) + + layer = cable.get_layer(layer_name) + assert isinstance(layer, HelicalLayer) + assert layer.lay_angle_rad is not None and layer.r_helix_m is not None + assert layer.n_wires is not None + rows: list[tuple[float, float, float]] = [] + local = 0.0 + for lyr in bonded_face_stack(cable, layer_name): + e = ( + youngs_modulus_Pa[lyr.name] + if youngs_modulus_Pa is not None + else _E(lyr.material) + ) + g = shear_modulus(e, library.get_property(lyr.material, "nu")) + r_in, r_out = lyr.r_inner_m or 0.0, lyr.r_outer_m or 0.0 + rows.append((r_in, r_out, g)) + local += (r_out - r_in) / g + alpha = abs(layer.lay_angle_rad) + r_contact = rows[0][0] + alpha_c = math.atan(math.tan(alpha) * r_contact / layer.r_helix_m) + spacing = 2.0 * math.pi * r_contact * math.cos(alpha_c) / layer.n_wires + try: + compliance = ( + math.cos(alpha) ** 2 * annulus_mode1_compliance_inner(rows) + + math.sin(alpha) ** 2 * local + ) / spacing + strip_concentration_compliance( + spacing, + min(0.5 * layer.wire_surface_width_m, 0.5 * spacing), + rows[0][1] - rows[0][0], + rows[0][2], + ) + except ValueError as error: + raise CableInputError( + f"{layer_name}: the bonded-face stiffness cannot be evaluated: {error}" + ) from error + return math.inf if compliance <= 0.0 else 1.0 / compliance + + +@uses_cable_materials +def bonded_face_terms( + cable: CableData, + layer_name: str, + xi_support: float, + *, + youngs_modulus_Pa: Mapping[str, float] | None = None, +) -> BondedFaceTerms: + """Bond terms of a helical layer with a bonded outer face (gap G8). + + The wires slide only on their inner face. The bond is a spring ``K_b`` + (:func:`bonded_face_stiffness`) in parallel with the inner support + ``K_s = xi_support k2 / (1 - xi_support)``, ``k2 = EA_w sin^2(a)/r_h^2``. + Stuck, the layer has ``xi_tot = (K_s + K_b) / (K_s + K_b + k2)`` + (``1`` for a rigid support); in full slip the bond keeps + ``xi_bond = K_b / (K_b + k2)``. The friction slider is given + ``xi_tot - xi_bond`` and the bond's ``xi_bond`` share of the + plane-section stiffness is added to the parallel EI of the law. + """ + layer = cable.get_layer(layer_name) + assert isinstance(layer, HelicalLayer) + assert layer.lay_angle_rad is not None and layer.r_helix_m is not None + assert layer.n_wires is not None + if not (0.0 < xi_support <= 1.0): + raise CableInputError(f"{layer_name}: xi_support must lie in (0, 1]") + k_b = bonded_face_stiffness(cable, layer_name, youngs_modulus_Pa=youngs_modulus_Pa) + e_wire = ( + youngs_modulus_Pa[layer.name] + if youngs_modulus_Pa is not None + else _E(layer.material) + ) + ea_w = e_wire * _wire_area(layer) + alpha = layer.lay_angle_rad + k2 = ea_w * math.sin(alpha) ** 2 / layer.r_helix_m**2 + xi_bond = yun_xi(k_b, ea_w, alpha, layer.r_helix_m) + if xi_support >= 1.0 or math.isinf(k_b): + xi_tot = 1.0 + else: + k_s = xi_support * k2 / (1.0 - xi_support) + xi_tot = (k_s + k_b) / (k_s + k_b + k2) + ei_plane = 0.5 * layer.n_wires * ea_w * layer.r_helix_m**2 * math.cos(alpha) ** 3 + return BondedFaceTerms(k_b, xi_bond, xi_tot - xi_bond, xi_bond * ei_plane) + + +@uses_cable_materials +def bonded_face_ei( + cable: CableData, *, youngs_modulus_Pa: Mapping[str, float] | None = None +) -> float: + """Sum of the bonds' bending stiffness ``ei_bond_Nm2`` over the cable [N·m²]. + + Zero when no structural helical layer declares ``bonded_face="outer"``. + The bond's share does not depend on the inner support, so + ``xi_support = 1`` is used. + """ + return sum( + bonded_face_terms( + cable, lyr.name, 1.0, youngs_modulus_Pa=youngs_modulus_Pa + ).ei_bond_Nm2 + for lyr in cable.helical_layers + if lyr.bonded_face == "outer" and lyr.structural + ) + + # --------------------------------------------------------------------------- # # Load sharing # # --------------------------------------------------------------------------- # diff --git a/src/cablexsec/mechanics/strand_slip.py b/src/cablexsec/mechanics/strand_slip.py index 0fa76b2..cde416c 100644 --- a/src/cablexsec/mechanics/strand_slip.py +++ b/src/cablexsec/mechanics/strand_slip.py @@ -42,8 +42,14 @@ resolved wire ring of a stranded conductor from geometry, friction and contact load. The stick slope is the plane-section strain ``R cos^2 alpha``; the slip slope is the local wire bending ``(d/2) cos^2 alpha cos 2 alpha`` -([Nasution2014b] Eq. 6); the friction amplitude integrates the available -friction force per unit wire length over a quarter pitch +([Nasution2014b] Eq. 6). At the outer fibre the normal curvature of the wire +follows its slip state +(:func:`cablexsec.mechanics.wire_stress.slip_state_normal_curvature`): the +axial strain the wire carries is taken ``1 + (d/2) sin^2 alpha / R`` times +(``StrandSlipParameters.slip_state_factor``), so the outer-fibre stick slope +is ``R cos^2 alpha + (d/2) cos^4 alpha`` and the slip slope stays +``(d/2) cos^2 alpha cos 2 alpha``. The friction amplitude integrates the +available friction force per unit wire length over a quarter pitch ([Nasution2014b] Eq. 7). The interface line loads are the inward helix loads of all rings outside the interface (with the ring's own load on its inner face), the reading of [Nasution2014b] Eq. 9 adopted here, plus an optional @@ -112,6 +118,13 @@ class StrandSlipParameters: eps_f_zero_tension : tuple of float Friction strain amplitudes at zero tension (pressure-held contact). Empty means zero, which is Eq. 4 exactly. + slip_state_factor : float + Factor on the wire-axis part ``eps_B - beta_n kappa`` of the bending + strain, the axial strain the wire carries (positive). At the outer + fibre of a wire it is ``1 + (d/2) sin^2 a / R``: the normal curvature + of the wire follows its slip state + (:func:`cablexsec.mechanics.wire_stress.slip_state_normal_curvature`). + ``1`` (default) leaves the operator of the source unchanged. """ alpha_per_N: float @@ -119,6 +132,7 @@ class StrandSlipParameters: eps_f_ref: tuple[float, ...] T0_N: float eps_f_zero_tension: tuple[float, ...] = field(default=()) + slip_state_factor: float = 1.0 def __post_init__(self) -> None: beta = tuple(float(x) for x in self.beta_m) @@ -131,6 +145,10 @@ def __post_init__(self) -> None: values = (self.alpha_per_N, self.T0_N, *beta, *ref, *zero) if not all(math.isfinite(x) for x in values): raise CableInputError("strand-slip parameters must be finite") + factor = float(self.slip_state_factor) + if not (math.isfinite(factor) and factor > 0.0): + raise CableInputError("slip_state_factor must be finite and positive") + object.__setattr__(self, "slip_state_factor", factor) if min(ref + zero, default=0.0) < 0: raise CableInputError("friction strain amplitudes must be nonnegative") if self.T0_N < 0 or (self.T0_N == 0 and ref != zero): @@ -346,6 +364,11 @@ def strand_slip_strain( np.ascontiguousarray(kappa_e), np.ascontiguousarray(eps_f), beta ) bending = order_strain[-1] + if parameters.slip_state_factor != 1.0: + # The axial part the wire carries, eps_B - beta_n kappa, sets the + # normal curvature of its slip state at the outer fibre. + local = beta[-1] * kappa_e + bending = local + parameters.slip_state_factor * (bending - local) axial = np.broadcast_to(parameters.alpha_per_N * tension, kappa_e.shape).copy() provenance = Provenance( method=( @@ -530,6 +553,13 @@ def _friction_strain( return math.pi * ring.r_helix_m * tau / (2.0 * s * ring.area_m2 * E_Pa) +def _outer_fibre_slip_factor( + d_wire_m: float, lay_angle_rad: float, r_helix_m: float +) -> float: + """``(d/2) sin^2 a / R``: outer-fibre normal curvature per wire-axis strain.""" + return 0.5 * d_wire_m * math.sin(lay_angle_rad) ** 2 / r_helix_m + + def conductor_ring_parameters( rings: Sequence[ConductorRing], E_Pa: float, @@ -629,6 +659,15 @@ def conductor_ring_parameters( face_mu = mu_out if i == last else mu_wire eps_ref = _friction_strain(ring, out_ref[i], in_ref[i], face_mu, mu_wire, E_Pa) eps_zero = _friction_strain(ring, out_0[i], in_0[i], face_mu, mu_wire, E_Pa) + # Outer fibre: the normal curvature follows the slip state. + factor = ( + 1.0 + + _outer_fibre_slip_factor( + ring.d_wire_m, ring.lay_angle_rad, ring.r_helix_m + ) + if fibre == "outer" + else 1.0 + ) parameters.append( StrandSlipParameters( alpha_per_N=alpha, @@ -636,6 +675,7 @@ def conductor_ring_parameters( eps_f_ref=(eps_ref,), T0_N=reference_tension_N, eps_f_zero_tension=(eps_zero,), + slip_state_factor=factor, ) ) return tuple(parameters) diff --git a/src/cablexsec/mechanics/tendon_bending.py b/src/cablexsec/mechanics/tendon_bending.py index 6592758..67ef435 100644 --- a/src/cablexsec/mechanics/tendon_bending.py +++ b/src/cablexsec/mechanics/tendon_bending.py @@ -15,9 +15,14 @@ * loxodrome (no transverse slip): lateral ``cos a (1 + sin^2 a) p_l`` (Sævik 1992 Eq. 2.65; Sævik 2011 Eq. 51; Lukassen 2019 Eq. 16), normal ``cos^2 a cos 2a p_n`` (the curve curvature of the deformed helix, Out and - von Morgen 1997 Eq. 41, used throughout CableXSec; Sævik's material value - for a stuck tendon is ``cos^4 a``, Eq. 2.66, which differs by the term of - the axial strain ``sin^2 a cos^2 a``, Skeie 2026 Eq. 15); + von Morgen 1997 Eq. 41; Leroy and Estrier 2001 Eq. 13), the normal + curvature of a tendon that carries no friction stress. The stress + recovery adds the term of the tendon's axial slip state, + ``(sin^2 a / r) sigma_f / E`` + (:func:`~cablexsec.mechanics.wire_stress.slip_state_normal_curvature`), + which gives Sævik's material value ``cos^4 a`` (Eq. 2.66) for a stuck + tendon; the coefficients below (the individual tendon bending of the + section stiffness) are those of the slipping tendon; * geodesic (free transverse slip): lateral ``0``, normal ``3 cos^2 a p_n`` (Sævik 1992 Eq. 2.32; Out and von Morgen Eq. 39; Lukassen Eq. 15); * partial transverse slip ``v = eta w_g p_l`` towards the geodesic offset @@ -132,7 +137,8 @@ def curvature_coefficients( ``eta = 0`` returns the coefficients of :func:`~cablexsec.mechanics.wire_stress.local_bending_fibre_stress` - (loxodrome), ``eta = 1`` the geodesic (module notes). + without a friction stress (loxodrome, slipping tendon), ``eta = 1`` the + geodesic (module notes). """ eta = float(transverse_fraction) if not (math.isfinite(eta) and 0.0 <= eta <= 1.0): diff --git a/src/cablexsec/mechanics/wire_stress.py b/src/cablexsec/mechanics/wire_stress.py index 3875cc9..dec9f74 100644 --- a/src/cablexsec/mechanics/wire_stress.py +++ b/src/cablexsec/mechanics/wire_stress.py @@ -10,7 +10,8 @@ wire strain of [Knapp1979], [FeretBournazel1987]). * ``sigma_B`` — the local wire bending stress at a specified material fibre, using both radial and tangential curvature components - ([MenardCartraud2023] Eq. 14). + ([MenardCartraud2023] Eq. 14), with the normal (radial) component + following the wire's axial slip state (below). * ``sigma_f`` — the friction (stick-slip) stress, the universal Coulomb return-mapping element (R1 Instantiation A). Its driving variable is the signed curvature projection ``kappa cos(phi - phi_bend)``, its elastic @@ -21,6 +22,34 @@ * ``sigma_T`` — the thermal stress ``E_w alpha_T (T(r_h) - T_amb)`` (supplied by the thermal solver; zero in an isothermal analysis). +Normal curvature and the slip state +----------------------------------- +The normal (out-of-surface, weak-axis for a flat wire) curvature change of +a wire on the deformed helix is ``cos^2(a) cos(2a) p_n`` per unit current +arc length, ``p_n = kappa_x cos(phi) + kappa_y sin(phi)`` (the curve +curvature of the helix carried with the bent surface: Out and von Morgen +1997 Eq. 41; Leroy and Estrier 2001 Eq. 13 without transverse slip). The +bending strain of the wire is set by the rotation of its cross-section per +unit material length, the curve curvature times the stretch ``1 + eps_w``. +The helix starts with the normal curvature ``sin^2(a) / r_h``, so to first +order + + dkappa_n = cos^2(a) cos(2a) p_n + (sin^2(a) / r_h) eps_w, + +with ``eps_w = sigma_f / E_w`` the bending-induced axial strain the wire +carries (:func:`slip_state_normal_curvature`). A stuck wire with the full +plane-section strain ``eps_w = r_h cos^2(a) p_n`` takes ``cos^4(a) p_n``; +with the shear-lag stick coefficient ``xi`` (``k_f = xi E_w cos^2 a``) it +takes ``cos^2(a) cos(2a) + xi sin^2(a) cos^2(a)``; a wire sliding freely +along its helix (``sigma_f = 0``) takes ``cos^2(a) cos(2a)``; a wire in +Coulomb slip keeps the slope ``cos^2(a) cos(2a)`` with the offset of its +friction stress. On the outer face the term is ``(t/2) (sin^2(a) / r_h) +sigma_f``, independent of the modulus. The lateral (in-surface) component +``cos(a) (1 + sin^2 a) p_l`` does not change: the helix starts with zero +geodesic curvature. The stick and slip limits were checked against an +independent finite-element model of a wire on a bent support (not +published). + The legacy axial/contact indicator combines the axial total with the circular contact shear estimate ``tau_H = 0.31 p0`` ([Johnson1985], nu = 0.3): @@ -39,6 +68,7 @@ from numpy.typing import NDArray from cablexsec.constants import TAU_MAX_OVER_P0_NU03 +from cablexsec.exceptions import CableInputError __all__ = [ "friction_stiffness", @@ -46,12 +76,53 @@ "local_bending_stress", "local_bending_amplitude", "local_bending_fibre_stress", + "slip_state_normal_curvature", "von_mises_stress", ] FloatArray = NDArray[np.float64] +def slip_state_normal_curvature( + friction_stress_Pa: float | FloatArray, + E_wire_Pa: float | FloatArray, + lay_angle_rad: float, + r_helix_m: float, +) -> FloatArray: + """Normal curvature of the wire's axial slip state [1/m] (module notes). + + ``(sin^2(a) / r_h) sigma_f / E_w``: the initial normal curvature of the + helix times the bending-induced axial strain ``sigma_f / E_w`` of the + wire. Added to the deformed-helix term ``cos^2(a) cos(2a) p_n`` it gives + ``cos^4(a) p_n`` for a stuck wire (``sigma_f = E_w r_h cos^2(a) p_n``), + ``cos^2(a) cos(2a) + xi sin^2(a) cos^2(a)`` with the stick coefficient + ``xi`` and nothing for a wire without friction stress. + """ + if not (math.isfinite(r_helix_m) and r_helix_m > 0.0): + raise CableInputError("the helix radius must be finite and positive") + coefficient = math.sin(lay_angle_rad) ** 2 / r_helix_m + return np.asarray( + coefficient * (np.asarray(friction_stress_Pa) / np.asarray(E_wire_Pa)), + dtype=np.float64, + ) + + +def _slip_term( + friction_stress_Pa: float | FloatArray | None, + E_wire_Pa: float | FloatArray, + lay_angle_rad: float, + r_helix_m: float | None, +) -> FloatArray | None: + """:func:`slip_state_normal_curvature`, or ``None`` without a friction stress.""" + if friction_stress_Pa is None: + return None + if r_helix_m is None: + raise CableInputError("a friction stress needs the helix radius r_helix_m") + return slip_state_normal_curvature( + friction_stress_Pa, E_wire_Pa, lay_angle_rad, r_helix_m + ) + + def local_bending_fibre_stress( kappa_x: float | FloatArray, kappa_y: float | FloatArray, @@ -60,6 +131,9 @@ def local_bending_fibre_stress( d_wire_m: float, lay_angle_rad: float, fibre_angle_rad: float | FloatArray = 0.0, + *, + friction_stress_Pa: float | FloatArray | None = None, + r_helix_m: float | None = None, ) -> FloatArray: """Signed bending stress on a fixed circular-wire material fibre [Pa]. @@ -70,6 +144,13 @@ def local_bending_fibre_stress( Array arguments follow NumPy broadcasting, e.g. wire azimuths ``[:, None]`` and curvature samples ``[None, :]``. No rotation of a critical fibre or instantaneous perimeter maximisation is used here. + + ``friction_stress_Pa`` (with the helix radius ``r_helix_m``) is the + bending-induced axial stress of the wire, which sets the normal + curvature of its slip state (:func:`slip_state_normal_curvature`, module + notes). Without it the normal coefficient is the slip limit + ``cos^2(a) cos(2a)`` ([MenardCartraud2023] Eq. 14), the curvature of a + wire that carries no friction stress. """ kx, ky = np.asarray(kappa_x), np.asarray(kappa_y) angle, theta = np.asarray(phi), np.asarray(fibre_angle_rad) @@ -77,6 +158,9 @@ def local_bending_fibre_stress( radial = ( c * c * math.cos(2 * lay_angle_rad) * (kx * np.cos(angle) + ky * np.sin(angle)) ) + slip = _slip_term(friction_stress_Pa, E_wire_Pa, lay_angle_rad, r_helix_m) + if slip is not None: + radial = radial + slip tangential = c * (1 + s * s) * (-kx * np.sin(angle) + ky * np.cos(angle)) return np.asarray( np.asarray(E_wire_Pa) @@ -112,23 +196,32 @@ def local_bending_stress( d_wire_m: float, lay_angle_rad: float, phi_bend: float = 0.0, + *, + friction_stress_Pa: float | FloatArray | None = None, + r_helix_m: float | None = None, ) -> FloatArray: """Local stress on the outward radial fibre ([MenardCartraud2023] Eq. 14). Phi is measured from the positive extension side, not from the source's - bending axis. The radial coefficient is cos²(a)*cos(2a); the tangential - coefficient enters the perimeter envelope in local_bending_amplitude. + bending axis. The radial coefficient is cos²(a)*cos(2a), plus the normal + curvature of the wire's slip state when its friction stress is given + (:func:`slip_state_normal_curvature`); the tangential coefficient enters + the perimeter envelope in local_bending_amplitude. """ a = lay_angle_rad phi_a = np.asarray(phi, dtype=np.float64) - return np.asarray( - E_wire_Pa - * kappa - * math.cos(a) ** 2 - * math.cos(2 * a) - * (d_wire_m / 2.0) - * np.cos(phi_a - phi_bend) - ) + slip = _slip_term(friction_stress_Pa, E_wire_Pa, a, r_helix_m) + if slip is None: + return np.asarray( + E_wire_Pa + * kappa + * math.cos(a) ** 2 + * math.cos(2 * a) + * (d_wire_m / 2.0) + * np.cos(phi_a - phi_bend) + ) + normal = kappa * math.cos(a) ** 2 * math.cos(2 * a) * np.cos(phi_a - phi_bend) + return np.asarray(E_wire_Pa * (d_wire_m / 2.0) * (normal + slip)) def local_bending_amplitude( @@ -138,23 +231,40 @@ def local_bending_amplitude( d_wire_m: float, lay_angle_rad: float, phi_bend: float = 0.0, + *, + friction_stress_Pa: float | FloatArray | None = None, + r_helix_m: float | None = None, ) -> FloatArray: """Maximum local bending stress over a circular wire perimeter [Pa]. This is the norm of the two Lutchansky bending coefficients, not the signed stress at one chosen fibre. Add it to abs(mean axial stress) when - screening the maximum absolute axial stress at a section. + screening the maximum absolute axial stress at a section. A given + friction stress (with ``r_helix_m``) adds the normal curvature of the + wire's slip state (:func:`slip_state_normal_curvature`) to the normal + component, with the sign of the signed curvature ``kappa``. """ angle = np.asarray(phi, dtype=np.float64) - phi_bend c, s = math.cos(lay_angle_rad), math.sin(lay_angle_rad) + slip = _slip_term(friction_stress_Pa, E_wire_Pa, lay_angle_rad, r_helix_m) + if slip is None: + return np.asarray( + E_wire_Pa + * abs(kappa) + * d_wire_m + / 2 + * np.hypot( + c * c * math.cos(2 * lay_angle_rad) * np.cos(angle), + c * (1 + s * s) * np.sin(angle), + ) + ) return np.asarray( E_wire_Pa - * abs(kappa) * d_wire_m / 2 * np.hypot( - c * c * math.cos(2 * lay_angle_rad) * np.cos(angle), - c * (1 + s * s) * np.sin(angle), + kappa * c * c * math.cos(2 * lay_angle_rad) * np.cos(angle) + slip, + kappa * c * (1 + s * s) * np.sin(angle), ) ) diff --git a/src/cablexsec/plotting/capacity.py b/src/cablexsec/plotting/capacity.py index fca2c9a..e82cdf4 100644 --- a/src/cablexsec/plotting/capacity.py +++ b/src/cablexsec/plotting/capacity.py @@ -10,6 +10,7 @@ from cablexsec.plotting.style import ( COLORS, + LABELS, annotate_provenance, use_style, ) @@ -23,9 +24,9 @@ # Mechanism -> house colour (the shared plotting convention). _MECH_COLOR = { - "wire_yield": COLORS["BLACK"], - "bird_caging": COLORS["RED"], - "polymer_crush": COLORS["BLUE"], + "wire_yield": COLORS["BLUE"], + "bird_caging": COLORS["ORANGE"], + "polymer_crush": COLORS["PURPLE"], "conductor": COLORS["GREEN"], } @@ -36,8 +37,8 @@ def plot_capacity_envelope(result: CapacityResult) -> Figure: Panel (a): the curvature capacity ``κ_max`` vs tension — the operating envelope — with each segment coloured by its governing mechanism. Panel (b): the tension-driven usage factors (bird-caging, polymer crush, conductor) vs - tension, with the UF = 1.0 (thick black) and UF = 0.8 (green dashed) - reference lines. The result's limitations are annotated verbatim. + tension, with the U = 1.0 (black) and U = 0.8 (grey dashed) reference + lines. The result's limitations are annotated verbatim. Returns ------- @@ -54,7 +55,6 @@ def plot_capacity_envelope(result: CapacityResult) -> Figure: t_kN, result.kappa_max_1_m, color=COLORS["BLACK"], - lw=1.6, zorder=2, label="capacity boundary", ) @@ -70,25 +70,23 @@ def plot_capacity_envelope(result: CapacityResult) -> Figure: label=mech.replace("_", " "), zorder=3, ) - axa.set_xlabel("tension [kN]") - axa.set_ylabel(r"curvature capacity $\kappa_{max}$ [1/m]") - axa.set_title("(a) capacity envelope") + axa.set_xlabel(LABELS["tension_kN"]) + axa.set_ylabel(r"Curvature capacity $\kappa_\mathrm{max}$ [m$^{\mathrm{-1}}$]") + axa.set_title("(a) Capacity envelope") axa.legend(loc="best", fontsize=8) # (b) tension-driven usage factors. axb.plot( t_kN, result.uf_bird_caging, - color=COLORS["RED"], - lw=1.3, + color=COLORS["ORANGE"], label="bird-caging", ) if np.any(np.isfinite(result.uf_polymer_crush)): axb.plot( t_kN, result.uf_polymer_crush, - color=COLORS["BLUE"], - lw=1.3, + color=COLORS["PURPLE"], label="polymer crush", ) else: @@ -100,16 +98,14 @@ def plot_capacity_envelope(result: CapacityResult) -> Figure: ha="right", va="bottom", fontsize=7, - color=COLORS["BLUE"], + color=COLORS["PURPLE"], ) - axb.plot( - t_kN, result.uf_conductor, color=COLORS["GREEN"], lw=1.3, label="conductor" - ) - axb.axhline(1.0, color=COLORS["BLACK"], lw=1.6, label="UF = 1.0") - axb.axhline(0.8, color=COLORS["GREEN"], ls="--", lw=0.9, label="UF = 0.8") - axb.set_xlabel("tension [kN]") - axb.set_ylabel("usage factor [-]") - axb.set_title("(b) tension-driven usage factors") + axb.plot(t_kN, result.uf_conductor, color=COLORS["GREEN"], label="conductor") + axb.axhline(1.0, color=COLORS["BLACK"], lw=1.0, label=r"$U$ = 1.0") + axb.axhline(0.8, color=COLORS["GREY"], ls="--", lw=1.0, label=r"$U$ = 0.8") + axb.set_xlabel(LABELS["tension_kN"]) + axb.set_ylabel(r"Usage factor $U$ [–]") + axb.set_title("(b) Tension-driven usage factors") axb.legend(loc="best", fontsize=8) annotate_provenance(axb, result.provenance, loc="lower right", max_items=2) diff --git a/src/cablexsec/plotting/cross_section.py b/src/cablexsec/plotting/cross_section.py index eb3c3d4..20f84ae 100644 --- a/src/cablexsec/plotting/cross_section.py +++ b/src/cablexsec/plotting/cross_section.py @@ -18,6 +18,7 @@ from cablexsec.plotting.style import ( COLORS, FIGSIZE, + LABELS, SIGNED_CMAP, annotate_provenance, material_color, @@ -97,8 +98,8 @@ def plot_cross_section( ax.set_xlim(-lim, lim) ax.set_ylim(-lim, lim) ax.set_aspect("equal") - ax.set_xlabel("x [m]") - ax.set_ylabel("y [m]") + ax.set_xlabel(LABELS["x_m"]) + ax.set_ylabel(LABELS["y_m"]) ax.set_title(title or f"{cable.cable.name} — cross-section") # Legend for the marker convention only when stress-coloured. if stress_result is not None: @@ -106,7 +107,7 @@ def plot_cross_section( [], [], facecolors=COLORS["GREY"], edgecolors="k", label="stuck wire" ) ax.scatter([], [], facecolors="none", edgecolors="k", label="slipping wire") - ax.legend(loc="upper right", fontsize=8, frameon=True, framealpha=0.9) + ax.legend(loc="upper right", fontsize=8) annotate_provenance(ax, stress_result.provenance, loc="lower left") # keep the unused import referenced for static checkers _ = (Circle, Annulus) @@ -223,10 +224,10 @@ def _draw_layer( def _component_label(component: str) -> str: """Pretty label for a stress component field name.""" names = { - "sigma_total_Pa": r"$\sigma_{total}$ [MPa]", - "sigma_A_Pa": r"$\sigma_A$ [MPa]", - "sigma_B_Pa": r"$\sigma_B$ [MPa]", - "sigma_f_Pa": r"$\sigma_f$ [MPa]", + "sigma_total_Pa": r"$\sigma_\mathrm{total}$ [MPa]", + "sigma_A_Pa": r"$\sigma_\mathrm{A}$ [MPa]", + "sigma_B_Pa": r"$\sigma_\mathrm{B}$ [MPa]", + "sigma_f_Pa": r"$\sigma_\mathrm{f}$ [MPa]", "sigma_vm_Pa": "Axial/contact indicator [MPa]", } return names.get(component, component) diff --git a/src/cablexsec/plotting/fatigue.py b/src/cablexsec/plotting/fatigue.py index 54c0cc8..92df43f 100644 --- a/src/cablexsec/plotting/fatigue.py +++ b/src/cablexsec/plotting/fatigue.py @@ -46,10 +46,10 @@ def plot_damage_split(result: FatigueResult) -> Figure: # (a) per-layer critical-wire damage split (log scale). parts = [ - ("bulk", result.D_bulk_per_wire, COLORS["BLACK"]), - ("fretting", result.D_fretting_per_wire, COLORS["RED"]), - ("termination", result.D_term_per_wire, COLORS["BLUE"]), - ("total", result.D_total_per_wire, COLORS["GREEN"]), + ("bulk", result.D_bulk_per_wire, COLORS["BLUE"]), + ("fretting", result.D_fretting_per_wire, COLORS["ORANGE"]), + ("termination", result.D_term_per_wire, COLORS["YELLOW"]), + ("total", result.D_total_per_wire, COLORS["PURPLE"]), ] x = np.arange(len(layers)) w = 0.2 @@ -60,8 +60,8 @@ def plot_damage_split(result: FatigueResult) -> Figure: axa.set_yscale("log") axa.set_xticks(x) axa.set_xticklabels(layers, fontsize=8, rotation=15) - axa.set_ylabel("damage per wire [-]") - axa.set_title("(a) damage split (critical wire)") + axa.set_ylabel(r"Miner damage per wire $D$ [–]") + axa.set_title("(a) Damage split (critical wire)") axa.legend(loc="best", fontsize=8) # (b) polar D_total(φ) for the critical layer. @@ -76,10 +76,9 @@ def plot_damage_split(result: FatigueResult) -> Figure: axb.plot( np.append(phi, phi[0]), np.append(d, d[0]), - color=COLORS["BLACK"], - lw=1.3, + color=COLORS["BLUE"], ) - axb.set_title(f"(b) $D_{{total}}(\\varphi)$ — {name}", fontsize=10) + axb.set_title(rf"(b) $D_\mathrm{{total}}(\varphi)$ — {name}", fontsize=10) annotate_provenance( axa, @@ -97,10 +96,10 @@ def plot_fretting_polar(result: StressResult, *, layer: str | None = None) -> Fi r"""Polar fretting distribution: 2D-Mindlin (uniform) vs loxodromic (zeros). Visualises the **rotation-invariance theorem**: the 2D vectorial Mindlin slip - gives a fretting amplitude **uniform** around the cross-section (black + gives a fretting amplitude **uniform** around the cross-section (blue circle), while the loxodromic (1D, neutral-axis-projected) model gives an amplitude ``∝ |cos(φ − φ_bend)|`` with **zeros at the neutral-axis wires** - (red dashed) — a qualitative failure the loxodromic model cannot avoid. The + (orange dashed) — a qualitative failure the loxodromic model cannot avoid. The per-wire azimuths and bending plane come from the :class:`StressResult`. Returns @@ -125,22 +124,20 @@ def plot_fretting_polar(result: StressResult, *, layer: str | None = None) -> Fi ax.plot( np.append(phi_s, phi_s[0]), np.append(uniform[order], uniform[order][0]), - color=COLORS["BLACK"], - lw=1.6, + color=COLORS["BLUE"], label="2D Mindlin (uniform)", ) ax.plot( np.append(phi_s, phi_s[0]), np.append(loxo[order], loxo[order][0]), - color=COLORS["RED"], + color=COLORS["ORANGE"], ls="--", - lw=1.4, - label="loxodromic ($|\\cos|$, zeros at NA)", + label=r"loxodromic ($|\cos(\varphi - \varphi_\mathrm{b})|$, zeros at NA)", ) # mark the neutral-axis wires (loxodromic zeros) na = np.abs(np.abs(np.cos(phi - phi_bend))) < 0.05 if np.any(na): - ax.scatter(phi[na], loxo[na], c=COLORS["RED"], s=30, zorder=5) + ax.scatter(phi[na], loxo[na], c=COLORS["ORANGE"], s=30, zorder=5) ax.set_rlim(0, 1.15) # type: ignore[attr-defined] # polar axes ax.set_title(f"Fretting amplitude shape — {name}", fontsize=10, pad=14) ax.legend(loc="upper right", bbox_to_anchor=(1.18, 1.10), fontsize=8) diff --git a/src/cablexsec/plotting/mkappa.py b/src/cablexsec/plotting/mkappa.py index 5d71435..220bfa7 100644 --- a/src/cablexsec/plotting/mkappa.py +++ b/src/cablexsec/plotting/mkappa.py @@ -12,6 +12,7 @@ from cablexsec.plotting.style import ( COLORS, FIGSIZE, + LABELS, annotate_provenance, use_style, ) @@ -38,9 +39,10 @@ def plot_mkappa( ) -> Axes: """Plot a model M-κ loop (public ``MkappaResult``), optionally vs experiment. - Solid black model loop; grey EI_max (dotted) / EI_min (dashed) reference - slopes; red open circles for experiment. The result's limitations are - annotated verbatim (e.g. the Papailiou-vs-Coulomb engine caveat). + Model loop in the first MATLAB colour; grey EI_max (dotted) / EI_min + (dashed) reference slopes; black open circles for experiment. The + result's limitations are annotated verbatim (e.g. the Papailiou-vs-Coulomb + engine caveat). Parameters ---------- @@ -69,8 +71,7 @@ def plot_mkappa( ax.plot( kappa, moment_kNm, - color=COLORS["BLACK"], - lw=1.6, + color=COLORS["BLUE"], label="CableXSec model", zorder=3, ) @@ -82,7 +83,7 @@ def plot_mkappa( color=COLORS["GREY"], ls=":", lw=1.0, - label=r"EI$_{max}$ (stuck)", + label=r"$EI_\mathrm{max}$ (stuck)", ) ax.plot( k_line, @@ -90,7 +91,7 @@ def plot_mkappa( color=COLORS["GREY"], ls="--", lw=1.0, - label=r"EI$_{min}$ (slip)", + label=r"$EI_\mathrm{min}$ (full slip)", ) if exp_kappa is not None and exp_moment_kNm is not None: @@ -101,7 +102,7 @@ def plot_mkappa( marker="o", ms=3.0, mfc="none", - mec=COLORS["RED"], + mec=COLORS["BLACK"], mew=0.7, label="Experiment", zorder=2, @@ -114,15 +115,16 @@ def plot_mkappa( ax.axhline(0.0, color=COLORS["GREY"], lw=0.5) ax.axvline(0.0, color=COLORS["GREY"], lw=0.5) - ax.set_xlabel(r"Curvature $\kappa$ [1/m]") - ax.set_ylabel(r"Bending moment $M$ [kN$\cdot$m]") + ax.set_xlabel(LABELS["curvature"]) + ax.set_ylabel(LABELS["moment_kNm"]) if title: ax.set_title(title) - ax.legend(loc="upper left", frameon=True, framealpha=0.9, fontsize=8) + ax.legend(loc="upper left", fontsize=8) txt = ( - f"$W_{{diss}}$ = {result.W_diss_J_per_m:.0f} J/m\n" - f"EI$_{{app}}$ = {result.EI_apparent_Nm2 / 1e3:.0f} kN$\\cdot$m$^2$" + rf"$W_\mathrm{{diss}}$ = {result.W_diss_J_per_m:.0f} J/m" + "\n" + rf"$EI_\mathrm{{app}}$ = {result.EI_apparent_Nm2 / 1e3:.0f} " + r"kN$\cdot$m$^\mathrm{2}$" ) ax.text( 0.97, @@ -135,7 +137,7 @@ def plot_mkappa( bbox={ "facecolor": "white", "edgecolor": COLORS["GREY"], - "boxstyle": "round,pad=0.3", + "boxstyle": "square,pad=0.3", }, ) if annotate: @@ -147,7 +149,7 @@ def plot_mkappa_validation_suite( results: dict[str, MkappaResult], *, experiments: dict[str, tuple[FloatArray, FloatArray]] | None = None, - suptitle: str = "M-κ validation suite", + suptitle: str = r"$M$–$\kappa$ validation suite", ) -> Figure: """Grid of M-κ loops (one per benchmark) with an error/summary table. diff --git a/src/cablexsec/plotting/stress.py b/src/cablexsec/plotting/stress.py index cbf2886..88fb750 100644 --- a/src/cablexsec/plotting/stress.py +++ b/src/cablexsec/plotting/stress.py @@ -14,6 +14,7 @@ from cablexsec.plotting.style import ( COLORS, FIGSIZE, + LABELS, SIGNED_CMAP, annotate_provenance, signed_norm, @@ -33,11 +34,11 @@ # (field, label, signed?) for the six panels, in reading order. _PANELS = [ - ("sigma_A_Pa", r"$\sigma_A$ (tension)", True), - ("sigma_B_Pa", r"$\sigma_B$ (bending)", True), - ("sigma_f_Pa", r"$\sigma_f$ (friction)", True), - ("sigma_T_Pa", r"$\sigma_T$ (thermal)", True), - ("sigma_total_Pa", r"$\sigma_{total}$", True), + ("sigma_A_Pa", r"$\sigma_\mathrm{A}$ (tension)", True), + ("sigma_B_Pa", r"$\sigma_\mathrm{B}$ (bending)", True), + ("sigma_f_Pa", r"$\sigma_\mathrm{f}$ (friction)", True), + ("sigma_T_Pa", r"$\sigma_\mathrm{T}$ (thermal)", True), + ("sigma_total_Pa", r"$\sigma_\mathrm{total}$", True), ("sigma_vm_Pa", "Axial/contact indicator", False), ] @@ -160,7 +161,7 @@ def _panel( ax.axhline(0.0, color=COLORS["GREY"], lw=0.5) ax.set_xlim(0, 360) ax.set_xticks([0, 90, 180, 270, 360]) - ax.set_xlabel(r"azimuth $\varphi$ [deg]", fontsize=9) + ax.set_xlabel(LABELS["azimuth"], fontsize=9) ax.set_ylabel(f"{label} [MPa]", fontsize=9) @@ -199,7 +200,7 @@ def plot_stress_timeseries( col[i].plot( t, series.curvature_x_1_m, - color=COLORS["BLACK"], + color=COLORS["BLUE"], lw=1.0, label=r"$\kappa_x$", ) @@ -207,37 +208,39 @@ def plot_stress_timeseries( col[i].plot( t, series.curvature_y_1_m, - color=COLORS["RED"], + color=COLORS["ORANGE"], lw=1.0, label=r"$\kappa_y$", ) - col[i].set_ylabel(r"$\kappa$ [1/m]", fontsize=9) + col[i].set_ylabel(r"$\kappa$ [m$^{\mathrm{-1}}$]", fontsize=9) col[i].legend(loc="upper right", fontsize=8) i += 1 if have_sig: assert sigma_crit_Pa is not None - col[i].plot(t, sigma_crit_Pa / 1e6, color=COLORS["BLACK"], lw=1.0) + col[i].plot(t, sigma_crit_Pa / 1e6, color=COLORS["BLUE"], lw=1.0) if sigma_y_Pa is not None: for s in (sigma_y_Pa, -sigma_y_Pa): col[i].axhline(s / 1e6, color=COLORS["RED"], ls="--", lw=0.8) - col[i].set_ylabel(r"$\sigma_{total}$ [MPa]", fontsize=9) + col[i].set_ylabel(r"$\sigma_\mathrm{total}$ [MPa]", fontsize=9) i += 1 if have_del: assert delta_star_um is not None col[i].plot(t, delta_star_um, color=COLORS["BLUE"], lw=1.0) - col[i].axhline(3.0, color=COLORS["GREEN"], ls="--", lw=0.8, label="3 µm Cu") col[i].axhline( - 5.0, color=COLORS["RED"], ls="--", lw=0.8, label="5 µm steel" + 3.0, color=COLORS["GREEN"], ls="--", lw=0.8, label="3 µm (Cu)" + ) + col[i].axhline( + 5.0, color=COLORS["RED"], ls="--", lw=0.8, label="5 µm (steel)" ) col[i].set_ylabel(r"$\delta^*$ [µm]", fontsize=9) col[i].legend(loc="upper right", fontsize=8) i += 1 - col[i].plot(t, series.tension_N / 1e3, color=COLORS["GREEN"], lw=1.0) - col[i].set_ylabel("tension [kN]", fontsize=9) - col[-1].set_xlabel("time [s]") + col[i].plot(t, series.tension_N / 1e3, color=COLORS["PURPLE"], lw=1.0) + col[i].set_ylabel(r"$T$ [kN]", fontsize=9) + col[-1].set_xlabel(LABELS["time"]) annotate_provenance(col[0], series.provenance, loc="upper left", max_items=2) fig.tight_layout() return fig diff --git a/src/cablexsec/plotting/style.py b/src/cablexsec/plotting/style.py index f1632ce..372befe 100644 --- a/src/cablexsec/plotting/style.py +++ b/src/cablexsec/plotting/style.py @@ -1,11 +1,22 @@ # SPDX-License-Identifier: Apache-2.0 # Copyright (c) 2026 Jae Hoon Seo, SMI Lab, Inha University -"""Publication-ready MATLAB-style plotting settings. +"""MATLAB-style plotting settings for every CableXSec figure. -All CableXSec figures share one visual style: a fixed six-colour palette, -Times New Roman serif at 11 pt, inward ticks, light grid, and 300 DPI output. -Apply it once at the top of a figure script with :func:`apply_style`, or scope -it to a block with :func:`use_style`. +The style follows MATLAB's default axes (R2014b and later): + +- the seven-colour ``lines`` order (blue, orange, yellow, purple, green, cyan, + dark red) as the line cycle; +- a sans-serif face (Helvetica, Arial or their metric clones) at 10 pt, axis + labels and titles at 11 pt; +- a closed box with inward ticks on all four sides, dark-grey axes, no grid; +- a square-cornered, opaque legend box. + +Symbols are typeset with matplotlib's mathtext in the same sans-serif face, so +labels carry Greek letters and true sub- and superscripts (``$\\kappa$``, +``$EI_\\mathrm{min}$``, ``m$^{\\mathrm{-1}}$``). Numerals inside math are +set upright with ``\\mathrm``, variables in italic. :data:`LABELS` holds the +standard axis labels. Apply the style once with :func:`apply_style`, or scope it with +:func:`use_style`. Examples -------- @@ -35,7 +46,9 @@ __all__ = [ "COLORS", "FIGSIZE", + "LABELS", "MATERIAL_COLORS", + "MATLAB_ORDER", "SIGNED_CMAP", "STYLE", "annotate_provenance", @@ -46,17 +59,35 @@ "use_style", ] -# Standard colour palette. Use these names, never ad-hoc hex codes. +#: MATLAB's default ``lines`` colour order (R2014b and later), in cycle order. +MATLAB_ORDER: tuple[str, ...] = ( + "#0072BD", # blue + "#D95319", # orange + "#EDB120", # yellow + "#7E2F8E", # purple + "#77AC30", # green + "#4DBEEE", # cyan + "#A2142F", # dark red +) + +# Named colours. Use these names, never ad-hoc hex codes. The hues are those of +# MATLAB_ORDER; BLACK and GREY are for references, data markers and outlines. COLORS: dict[str, str] = { - "BLACK": "#000000", # primary lines, critical results - "RED": "#CC0000", # warning, critical, threshold, hot - "BLUE": "#0000CC", # primary data, reference, cold - "GREEN": "#006600", # safe, secondary data - "GREY": "#666666", # reference lines, minor data - "ORANGE": "#CC6600", # tertiary data + "BLUE": MATLAB_ORDER[0], # primary model result + "ORANGE": MATLAB_ORDER[1], # second series, measured data + "YELLOW": MATLAB_ORDER[2], + "PURPLE": MATLAB_ORDER[3], + "GREEN": MATLAB_ORDER[4], # safe, secondary data + "CYAN": MATLAB_ORDER[5], + "RED": MATLAB_ORDER[6], # warning, critical, threshold, hot + "BLACK": "#000000", # measured markers, outlines + "GREY": "#808080", # reference lines, minor data } -# Canonical figure sizes [inches] — one width language across the paper. +#: MATLAB's axes and text colour, ``[0.15 0.15 0.15]``. +_AXES_GREY = "#262626" + +# Canonical figure sizes [inches]. FIGSIZE: dict[str, tuple[float, float]] = { "single": (5.0, 4.2), # one-panel figure "wide": (7.0, 3.6), # time-series / wide aspect @@ -65,8 +96,28 @@ "suite": (9.0, 6.5), # validation-suite grid } -# The ONE signed-field colormap: blue (-) -> white (0) -> red (+), built from -# the house palette. Diverging fields use THIS, never rainbow/jet (which encodes +#: Standard axis labels, with symbols and SI units. +LABELS: dict[str, str] = { + "curvature": r"Curvature $\kappa$ [m$^{\mathrm{-1}}$]", + "curvature_milli": r"Curvature $\kappa$ [$10^{\mathrm{-3}}$ m$^{\mathrm{-1}}$]", + "moment_Nm": r"Bending moment $M$ [N$\cdot$m]", + "moment_kNm": r"Bending moment $M$ [kN$\cdot$m]", + "tension_kN": r"Tension $T$ [kN]", + "time": r"Time $t$ [s]", + "azimuth": r"Wire azimuth $\varphi$ [$^\circ$]", + "radius_mm": r"Radius $r$ [mm]", + "temperature": r"Temperature $T$ [$^\circ$C]", + "stress": r"Stress $\sigma$ [MPa]", + "x_mm": r"$x$ [mm]", + "y_mm": r"$y$ [mm]", + "x_m": r"$x$ [m]", + "y_m": r"$y$ [m]", + "damage": r"Miner damage $D$ [–]", + "slip_um": r"Slip amplitude $\delta$ [µm]", +} + +# The ONE signed-field colormap: blue (-) -> white (0) -> dark red (+), from the +# MATLAB hues. Diverging fields use THIS, never rainbow/jet (which encodes # magnitude as hue and is unreadable for sign). SIGNED_CMAP: Colormap = LinearSegmentedColormap.from_list( "cablexsec_signed", [COLORS["BLUE"], "#FFFFFF", COLORS["RED"]], N=256 @@ -74,63 +125,97 @@ # Material -> fill colour for the by-material cross-section view. MATERIAL_COLORS: dict[str, str] = { - "steel": COLORS["GREY"], - "copper": COLORS["ORANGE"], - "cu": COLORS["ORANGE"], - "xlpe": COLORS["BLUE"], - "hdpe": "#BBBBBB", - "pp": "#DDDDDD", - "lead": "#444444", - "aluminium": "#AAAAAA", - "al": "#AAAAAA", + "steel": "#8C8C8C", + "copper": "#D9874A", + "cu": "#D9874A", + "xlpe": "#9CC3E4", + "epr": "#9CC3E4", + "hdpe": "#BFBFBF", + "mdpe": "#CFCFCF", + "ldpe": "#DCDCDC", + "pp": "#E6E6E6", + "lead": "#4D4D4D", + "aluminium": "#A6A6A6", + "al": "#A6A6A6", } # Matplotlib rcParams for the house style. STYLE: dict[str, object] = { - "font.family": "serif", - "font.serif": ["Times New Roman", "DejaVu Serif"], - "font.size": 11, + # Text: MATLAB's Helvetica, with Arial and metric clones as fallbacks. + "font.family": "sans-serif", + "font.sans-serif": [ + "Helvetica", + "Arial", + "Liberation Sans", + "Nimbus Sans", + "DejaVu Sans", + ], + "font.size": 10, "axes.labelsize": 11, "axes.titlesize": 11, + "axes.titleweight": "bold", "xtick.labelsize": 10, "ytick.labelsize": 10, - "legend.fontsize": 10, - "figure.dpi": 300, - "savefig.dpi": 300, - "savefig.bbox": "tight", - "savefig.pad_inches": 0.05, - "lines.linewidth": 1.5, - "lines.markersize": 6, - "axes.linewidth": 0.8, + "legend.fontsize": 9, + "text.color": _AXES_GREY, + "text.usetex": False, + # Symbols in the same sans-serif face as the text. + "mathtext.fontset": "custom", + "mathtext.rm": "sans", + "mathtext.it": "sans:italic", + "mathtext.bf": "sans:bold", + "mathtext.sf": "sans", + "mathtext.default": "it", + "axes.unicode_minus": True, + # an axis offset reads x10^-8, as in MATLAB, not 1e-8 + "axes.formatter.use_mathtext": True, + # Axes: closed box, inward ticks on all sides, no grid. + "axes.linewidth": 0.6, + "axes.edgecolor": _AXES_GREY, + "axes.labelcolor": _AXES_GREY, + "axes.spines.top": True, + "axes.spines.right": True, + "axes.grid": False, + "grid.color": _AXES_GREY, + "grid.alpha": 0.15, + "grid.linewidth": 0.5, + "axes.prop_cycle": cycler(color=list(MATLAB_ORDER)), + "axes.facecolor": "white", "xtick.direction": "in", "ytick.direction": "in", + "xtick.top": True, + "ytick.right": True, + "xtick.color": _AXES_GREY, + "ytick.color": _AXES_GREY, "xtick.major.size": 4, "ytick.major.size": 4, - "axes.grid": True, - "grid.alpha": 0.3, - "grid.linewidth": 0.5, - "grid.color": "#999999", - "axes.spines.top": True, - "axes.spines.right": True, + "xtick.major.width": 0.6, + "ytick.major.width": 0.6, + "xtick.minor.visible": False, + "ytick.minor.visible": False, + # Lines and markers. + "lines.linewidth": 1.5, + "lines.markersize": 6, + "lines.markeredgewidth": 0.8, + "patch.linewidth": 0.6, + # Legend: square, opaque, thin dark edge. + "legend.frameon": True, + "legend.fancybox": False, + "legend.framealpha": 1.0, + "legend.edgecolor": _AXES_GREY, + "legend.shadow": False, + # Figure and output. "figure.facecolor": "white", - "axes.facecolor": "white", - "text.usetex": False, - # Default colour cycle follows the house palette. - "axes.prop_cycle": cycler( - color=[ - COLORS["BLACK"], - COLORS["RED"], - COLORS["BLUE"], - COLORS["GREEN"], - COLORS["GREY"], - COLORS["ORANGE"], - ] - ), + "figure.dpi": 150, + "savefig.dpi": 300, + "savefig.bbox": "tight", + "savefig.pad_inches": 0.05, + "savefig.facecolor": "white", } def apply_style() -> None: - """Apply the CableXSec house style to the global matplotlib rcParams.""" + """Apply the CableXSec MATLAB-style settings to the global rcParams.""" cast(Any, mpl.rcParams).update(STYLE) @@ -219,7 +304,7 @@ def annotate_provenance( bbox={ "facecolor": "white", "edgecolor": COLORS["GREY"], - "boxstyle": "round,pad=0.25", + "boxstyle": "square,pad=0.25", "alpha": 0.92, "linewidth": 0.5, }, diff --git a/src/cablexsec/plotting/thermal.py b/src/cablexsec/plotting/thermal.py index 5e4b213..4d14838 100644 --- a/src/cablexsec/plotting/thermal.py +++ b/src/cablexsec/plotting/thermal.py @@ -9,6 +9,7 @@ from cablexsec.plotting.style import ( COLORS, FIGSIZE, + LABELS, annotate_provenance, use_style, ) @@ -47,9 +48,7 @@ def plot_temperature_gradient( _, ax = plt.subplots(figsize=FIGSIZE["single"]) r_mm = result.r_m * 1e3 - ax.plot( - r_mm, result.T_C, color=COLORS["BLACK"], lw=1.6, zorder=3, label=r"$T(r)$" - ) + ax.plot(r_mm, result.T_C, color=COLORS["BLUE"], zorder=3, label=r"$T(r)$") if cable is not None: for lyr in cable.layers: @@ -63,25 +62,25 @@ def plot_temperature_gradient( result.T_conductor_C, color=COLORS["RED"], ls="--", - lw=0.9, - label=f"conductor {result.T_conductor_C:.1f} °C", + lw=1.0, + label=rf"conductor {result.T_conductor_C:.1f} $^\circ$C", ) ax.axhline( result.T_armour_C, - color=COLORS["BLUE"], + color=COLORS["ORANGE"], ls="--", - lw=0.9, - label=f"armour {result.T_armour_C:.1f} °C", + lw=1.0, + label=rf"armour {result.T_armour_C:.1f} $^\circ$C", ) - ax.set_xlabel("radius [mm]") - ax.set_ylabel("temperature [°C]") + ax.set_xlabel(LABELS["radius_mm"]) + ax.set_ylabel(LABELS["temperature"]) ax.set_title("Radial temperature gradient") ax.legend(loc="upper right", fontsize=8) lines = [ f"$P$ = {result.P_total_W_m:.1f} W/m", - f"$T_{{cond}}$ = {result.T_conductor_C:.1f} °C", + rf"$T_\mathrm{{cond}}$ = {result.T_conductor_C:.1f} $^\circ$C", ] if current_A is not None: lines.insert(0, f"$I$ = {current_A:.0f} A") @@ -96,7 +95,7 @@ def plot_temperature_gradient( bbox={ "facecolor": "white", "edgecolor": COLORS["GREY"], - "boxstyle": "round,pad=0.3", + "boxstyle": "square,pad=0.3", }, ) annotate_provenance(ax, result.provenance, loc="upper left", max_items=2) diff --git a/tests/test_bonded_face.py b/tests/test_bonded_face.py new file mode 100644 index 0000000..793b9f0 --- /dev/null +++ b/tests/test_bonded_face.py @@ -0,0 +1,290 @@ +# SPDX-License-Identifier: Apache-2.0 +# Copyright (c) 2026 Jae Hoon Seo, SMI Lab, Inha University +"""Bonded outer armour face (``bonded_face="outer"``, gap G8). + +Closed form of the inner-loaded annulus compliance; the default unchanged bit +for bit; the stuck section unchanged and the full-slip tangent raised by the +bond's share; the friction cap from the inner face only; energy balance; and +refusal on the routes that would miss the bond's share of the wire force. +""" + +from __future__ import annotations + +import math +from importlib.resources import files + +import numpy as np +import pytest +from pydantic import ValidationError + +import cablexsec as cx +from cablexsec.api import _prepare_mkappa_law +from cablexsec.cable_adapters import ( + _bounded_face_pressures, + cable_to_mkappa_specs, +) +from cablexsec.cables.schema import CableData +from cablexsec.exceptions import CableInputError, CableSchemaError +from cablexsec.mechanics.axisymmetric import compute_contact_forces +from cablexsec.mechanics.stick_support import annulus_mode1_compliance_inner +from cablexsec.mechanics.stiffness import ( + bonded_face_ei, + bonded_face_terms, + ei_min_slip, + xi_for_layer, +) + +G = 3.0e8 + + +def _zeidan() -> CableData: + return cx.load_cable( + files("cablexsec.cables") / "zeidan2025.yaml", geometry_override=None + ) + + +def _bond( + cable: CableData, name: str = "outer_armour", face: str = "outer" +) -> CableData: + layers = [ + lyr.model_copy(update={"bonded_face": face}) if lyr.name == name else lyr + for lyr in cable.layers + ] + return cable.model_copy(update={"layers": layers}) + + +def _law(cable: CableData): # type: ignore[no-untyped-def] + with cable.material_scope(): + return _prepare_mkappa_law( + cable, + 0.0, + mu=0.2, + phi_bend=0.0, + contact_model="bounded", + section_state=None, + radial_state=None, + core_spec=None, + progressive=None, + ) + + +@pytest.mark.analytical_sanity +def test_inner_loaded_single_layer_is_the_closed_form() -> None: + r_i, r_o = 0.05, 0.056 + expected = r_i * (r_i**2 + r_o**2) / (G * (r_o**2 - r_i**2)) + assert annulus_mode1_compliance_inner([(r_i, r_o, G)]) == pytest.approx( + expected, rel=1e-12 + ) + + +@pytest.mark.analytical_sanity +def test_inner_loaded_split_layer_equals_the_whole_layer() -> None: + whole = annulus_mode1_compliance_inner([(0.05, 0.056, G)]) + split = annulus_mode1_compliance_inner([(0.05, 0.053, G), (0.053, 0.056, G)]) + assert split == pytest.approx(whole, rel=1e-12) + + +def test_inner_loaded_refuses_overlap_and_empty_is_zero() -> None: + assert annulus_mode1_compliance_inner([]) == 0.0 + with pytest.raises(ValueError, match="overlap"): + annulus_mode1_compliance_inner([(0.05, 0.056, G), (0.054, 0.06, G)]) + + +def test_default_cable_has_no_bond_and_an_unchanged_law() -> None: + cable = _bond(_zeidan(), face="none") + with cable.material_scope(): + assert bonded_face_ei(cable) == 0.0 + ei_min = ei_min_slip(cable) + menard = cx.load_cable(cx.menard2023_yaml_path(), geometry_override=None) + explicit = _bond(menard, name="outer_armour", face="none") + np.testing.assert_array_equal( + _law(menard).run(np.linspace(0.0, 0.1, 51)).moment_Nm, + _law(explicit).run(np.linspace(0.0, 0.1, 51)).moment_Nm, + ) + explicit = _bond(cable, face="none") + kappa = np.r_[np.linspace(0.0, 0.1, 51), np.linspace(0.1, -0.1, 101)[1:]] + a, b = _law(cable).run(kappa), _law(explicit).run(kappa) + np.testing.assert_array_equal(a.moment_Nm, b.moment_Nm) + assert cx.compute_stiffness(cable).ei_min_Nm2 == ei_min + + +def test_bond_terms_keep_the_stuck_layer_and_add_the_bond_share() -> None: + cable = _bond(_zeidan()) + with cable.material_scope(): + xi_support = xi_for_layer(cable, "outer_armour") + terms = bonded_face_terms(cable, "outer_armour", xi_support) + # A compliant support: stuck, the support and the bond in parallel. + soft = bonded_face_terms(cable, "outer_armour", 0.5) + ei_bond = bonded_face_ei(cable) + assert 0.0 < terms.xi_bond < 1.0 + if xi_support >= 1.0: + assert terms.xi_slider + terms.xi_bond == pytest.approx(1.0, abs=1e-15) + k2 = terms.stiffness_N_m2 * (1.0 - terms.xi_bond) / terms.xi_bond + k_s = 0.5 * k2 / 0.5 # xi_support = 0.5 + expected = (k_s + terms.stiffness_N_m2) / (k_s + terms.stiffness_N_m2 + k2) + assert soft.xi_slider + soft.xi_bond == pytest.approx(expected, rel=1e-12) + assert ei_bond == pytest.approx(terms.ei_bond_Nm2, rel=1e-15) + + +def test_law_stuck_stiffness_unchanged_and_full_slip_tangent_raised() -> None: + base, bonded = _bond(_zeidan(), face="none"), _zeidan() + law0, law1 = _law(base), _law(bonded) + with bonded.material_scope(): + ei_bond = bonded_face_ei(bonded) + assert law1.ei_min == pytest.approx(law0.ei_min + ei_bond, rel=1e-15) + stuck0 = law0.ei_min + sum(s.EI_stick for s in law0.layers) + stuck1 = law1.ei_min + sum(s.EI_stick for s in law1.layers) + assert stuck1 == pytest.approx(stuck0, rel=1e-12) + kappa = np.linspace(0.0, 0.3, 601) + m = law1.run(kappa).moment_Nm + tangent = (m[-1] - m[-41]) / (kappa[-1] - kappa[-41]) + assert tangent == pytest.approx(law1.ei_min, rel=1e-6) + + +def test_friction_cap_is_the_inner_face_share() -> None: + base, bonded = _bond(_zeidan(), face="none"), _zeidan() + with bonded.material_scope(): + p_ext = bonded.initial_state.external_pressure_Pa + cf = compute_contact_forces(bonded, 0.0, p_ext_Pa=p_ext) + below, above = _bounded_face_pressures(bonded, cf.interface_pressure_Pa, p_ext)[ + "outer_armour" + ] + s0 = cable_to_mkappa_specs(base, mu=0.2) + s1 = cable_to_mkappa_specs(bonded, mu=0.2, bonded_faces=True) + share = below / (below + above) + assert 0.0 < share < 1.0 + names = [lyr.name for lyr in bonded.helical_layers] + i = names.index("outer_armour") + assert s1[i].contact_pressure_Pa == pytest.approx( + s0[i].contact_pressure_Pa * share, rel=1e-12 + ) + assert s1[i].F_n_axi_N == pytest.approx(s0[i].F_n_axi_N * share, rel=1e-12) + j = names.index("inner_armour") + assert s1[j] == s0[j] + + +def test_bonded_law_closes_its_energy_balance() -> None: + kappa = np.r_[np.linspace(0.0, 0.15, 151), np.linspace(0.15, -0.15, 301)[1:]] + work = _law(_bond(_zeidan())).run(kappa).work + scale = float(np.max(np.abs(work.friction_J_per_m))) + 1.0 + assert np.max(np.abs(work.balance_residual_J_per_m)) < 1e-6 * scale + + +def test_routes_without_the_bond_share_refuse_a_bonded_cable() -> None: + bonded = _bond(_zeidan()) + with bonded.material_scope(), pytest.raises(CableSchemaError, match="bonded_face"): + cable_to_mkappa_specs(bonded, mu=0.2) + with bonded.material_scope(), pytest.raises(CableSchemaError, match="bounded"): + cable_to_mkappa_specs(bonded, mu=0.2, contact_model="qp", bonded_faces=True) + + +def test_bond_needs_the_outermost_helical_layer() -> None: + cable = _bond(_zeidan(), name="inner_armour") + with cable.material_scope(), pytest.raises(CableInputError, match="outermost"): + bonded_face_terms(cable, "inner_armour", 1.0) + + +def test_schema_refuses_an_unknown_face() -> None: + lyr = next(lyr for lyr in _zeidan().layers if lyr.name == "outer_armour") + with pytest.raises(ValidationError): + type(lyr).model_validate({**lyr.model_dump(), "bonded_face": "inner"}) + + +def test_bond_share_is_small_for_a_thick_soft_free_sheath() -> None: + cable = _bond(_zeidan()) + with cable.material_scope(): + terms = bonded_face_terms(cable, "outer_armour", 1.0) + assert math.isfinite(terms.stiffness_N_m2) and terms.xi_bond < 0.2 + + +def test_exported_law_carries_the_bond_and_runs_outside_a_scope() -> None: + """The global-analysis export (raw module function, no outer material + scope) reads the cable's own materials and exports the bonded full-slip + stiffness.""" + from cablexsec.analysis.bending_law import export_bending_law # noqa: PLC0415 + + cable = _zeidan() + out = export_bending_law( + cable, tensions_N=[0.0, 50e3], kappa_max_1_m=0.2, n_points=40 + ) + sliding = cx.compute_stiffness(_bond(cable, face="none")).ei_min_Nm2 + bond = bonded_face_ei(cable) # decorated: its own material scope + np.testing.assert_allclose(out.ei_slip_Nm2, sliding + bond, rtol=1e-12) + assert bond > 1e3 + + +def test_tension_history_keeps_the_inner_face_share() -> None: + """A constant tension history gives the fixed-tension law: the history's + P1+P2 is split into the inner face's share at every sample, as the specs + are at a fixed tension.""" + cable = _zeidan() + kappa = np.r_[np.linspace(0.0, 0.1, 51), np.linspace(0.1, -0.1, 101)[1:]] + fixed = cx.compute_mkappa(cable, kappa, tension_N=50e3, mu=0.2) + history = cx.compute_mkappa( + cable, + kappa, + mu=0.2, + contact_tension_history_N=np.full(kappa.shape, 50e3), + ) + np.testing.assert_allclose(history.moment_Nm, fixed.moment_Nm, rtol=1e-9, atol=1e-9) + unsplit = cx.compute_mkappa( + _bond(cable, face="none"), + kappa, + mu=0.2, + contact_tension_history_N=np.full(kappa.shape, 50e3), + ) + assert np.max(np.abs(history.moment_Nm - unsplit.moment_Nm)) > 1.0 + + +def test_a_pressure_history_is_refused_for_a_bonded_face() -> None: + cable = _zeidan() + kappa = np.linspace(0.0, 0.1, 11) + pressure = {lyr.name: np.full(kappa.shape, 1e6) for lyr in cable.helical_layers} + with pytest.raises(CableSchemaError, match="contact_tension_history_N"): + cx.compute_mkappa(cable, kappa, mu=0.2, contact_pressure_Pa=pressure) + + +def test_a_straight_bonded_layer_is_elastic_only() -> None: + """At a zero lay angle the bond carries the whole layer (xi_slider = 0): + the slider is elastic-only, and the law is the small-angle limit.""" + + def straight(lay_deg: float) -> CableData: + cable = _zeidan() + layers = [ + lyr.model_copy(update={"lay_angle_deg": lay_deg}) + if lyr.name == "outer_armour" + else lyr + for lyr in cable.layers + ] + return cable.model_copy(update={"layers": layers}) + + zero, small = straight(0.0), straight(1e-4) + with zero.material_scope(): + terms = bonded_face_terms(zero, "outer_armour", 1.0) + assert terms.xi_bond == 1.0 and terms.xi_slider == 0.0 + kappa = np.r_[np.linspace(0.0, 0.1, 21), np.linspace(0.1, -0.1, 41)[1:]] + for options in ({}, {"friction_model": "progressive"}): + r0 = cx.compute_mkappa(zero, kappa, mu=0.2, **options) # type: ignore[arg-type] + r1 = cx.compute_mkappa(small, kappa, mu=0.2, **options) # type: ignore[arg-type] + scale = float(np.max(np.abs(r1.moment_Nm))) + np.testing.assert_allclose(r0.moment_Nm, r1.moment_Nm, atol=1e-9 * scale) + assert r0.EI_min_Nm2 == pytest.approx(r1.EI_min_Nm2, rel=1e-8) + + +def test_a_zero_stick_stiffness_gives_an_elastic_only_history() -> None: + from cablexsec.mechanics.papailiou import wire_slip_history # noqa: PLC0415 + + with _zeidan().material_scope(): + spec = cable_to_mkappa_specs(_bond(_zeidan(), face="none"), mu=0.2)[0] + kappa = np.linspace(0.0, 0.1, 11) + zero = np.zeros_like(kappa) + history = wire_slip_history(spec, kappa, zero, stick_modulus_Pa=zero) + assert not np.any(history.stress_Pa) and not np.any(history.moment_Nm) + assert not np.any(history.slipping_count) + assert not np.any(history.work.friction_J_per_m) + partly = np.full_like(kappa, spec.k_f) + partly[3] = 0.0 + with pytest.raises(CableInputError, match="positive stiffness"): + wire_slip_history(spec, kappa, zero, stick_modulus_Pa=partly) + with pytest.raises(CableInputError, match="elastic-only"): + wire_slip_history(spec, kappa, zero, stick_modulus_Pa=zero, keep_cap=True) diff --git a/tests/test_capacity.py b/tests/test_capacity.py index bb96222..2d6aaaf 100644 --- a/tests/test_capacity.py +++ b/tests/test_capacity.py @@ -282,6 +282,9 @@ def test_capacity_boundary_matches_public_stress_engine() -> None: layer.d_wire_m, layer.lay_angle_rad, stress.phi_bend_rad, + # The normal curvature follows each wire's slip state. + friction_stress_Pa=stress.sigma_f_Pa[layer.name], + r_helix_m=layer.r_helix_m, ) usage = max( usage, diff --git a/tests/test_core_coupled_slip.py b/tests/test_core_coupled_slip.py new file mode 100644 index 0000000..59e1c25 --- /dev/null +++ b/tests/test_core_coupled_slip.py @@ -0,0 +1,706 @@ +# SPDX-License-Identifier: Apache-2.0 +# Copyright (c) 2026 Jae Hoon Seo, SMI Lab, Inha University +"""Relative core--core slip of laid cores (``core_core_coupling="relative"``). + +The coupled station law of :mod:`cablexsec.mechanics.station_coupling` against +the independent field solver ``validation/scripts/coupled_core_slip_reference.py`` +(onset, full slip, moment, friction-stress distribution, reversal loop), its +limits, the agreement of the compiled and NumPy return maps, and the default +law, which is unchanged. +""" + +from __future__ import annotations + +import dataclasses +import math +import warnings + +import numpy as np +import pytest +from coupled_core_slip_reference import CoupledSlipReference, run_path + +import cablexsec as cx +from cablexsec.exceptions import CableInputError, CableSchemaError +from cablexsec.mechanics import station_coupling +from cablexsec.mechanics.core_friction import ( + CoreFrictionSpec, + build_core_friction, + core_friction_history, + core_full_slip_curvature, + core_full_slip_moment, + core_load_history, + core_station_bounds, + core_station_history, +) +from cablexsec.mechanics.mkappa import HelicalLayerSpec +from cablexsec.mechanics.papailiou import ( + coupled_slip_stress_bounds, + slip_onset_curvature, + wire_slip_history, +) +from cablexsec.mechanics.station_coupling import ( + StationCoupling, + group_view, + project_station_groups, +) +from cablexsec.provenance import FrictionModelFallbackWarning + +T = 50.0e3 +RELATIVE = CoreFrictionSpec(core_core_coupling="relative") +#: 2 pi / (3 sqrt 3): full slip over onset of three cores in core-core contact. +FULL_SLIP_RATIO = 2.0 * math.pi / (3.0 * math.sqrt(3.0)) + + +@pytest.fixture(scope="module") +def cable(): + return cx.load_cable(cx.iea_task49_66kv_yaml_path(), geometry_override=None) + + +def _population(n: int, spc: int, mu: float = 0.2) -> HelicalLayerSpec: + """Rigid stations of ``n`` cores, lay angle small enough that the capstan + term of the interlayer bound stays below 2e-4 relative.""" + return HelicalLayerSpec( + n_wires=n * spc, + r_helix_m=0.05, + lay_angle_rad=math.asin(1.0e-3), + E_wire_Pa=1.0e10, + A_wire_m2=1.0e-4, + xi=1.0, + mu=mu, + F_n_axi_N=100.0, + contact_pressure_Pa=1.0e5, + normal_load_is_line=True, + ) + + +def _library(share_cc: float, a: np.ndarray, *, n: int = 3, spc: int = 240): + """Coupled law at ``a = kappa / kappa_on``: interlayer coefficient + ``mu (1 - share)``, core-core coefficient ``mu`` on ``share`` of the load.""" + layer = _population(n, spc) + coupling = StationCoupling( + n, layer.mu * (1.0 - share_cc), layer.mu, layer.contact_pressure_Pa * share_cc + ) + on = slip_onset_curvature(layer) + history = wire_slip_history( + layer, + a * on, + np.zeros_like(a), + coupling=coupling, + direction_hold_fraction=0.0, + ) + return history, layer, on + + +# --------------------------------------------------------------------------- # +# Independent field solver (registered comparison) # +# --------------------------------------------------------------------------- # +CASES = { + # label: (b_a, b_c, core-core share of the capacity) + "intralayer": (0.0, 1.0, 1.0), + "mixed": (1.0, 0.5, 0.5), + "interlayer": (1.0, 0.0, 0.0), +} + + +@pytest.fixture(scope="module", params=sorted(CASES)) +def loop(request): + """Reference and library over 0 -> 1.7 -> -1.7 -> 1.7 (units of onset).""" + b_a, b_c, share = CASES[request.param] + ref = CoupledSlipReference(nodes=240, b_c=b_c, b_a=b_a) + up = np.concatenate([[0.5, 0.9, 0.98], np.arange(1.0025, 1.7 + 1e-9, 0.0075)]) + down = np.arange(1.7, -1.7 - 1e-9, -0.02)[1:] + back = np.arange(-1.7, 1.7 + 1e-9, 0.02)[1:] + path = np.concatenate([up, down, back]) + keep = tuple(int(np.argmin(np.abs(up - v))) for v in (0.98, 1.03, 1.1, 1.2, 1.5)) + out = run_path(ref, path * ref.a_cr, keep=keep) + history, layer, on = _library(share, path) + return request.param, ref, path, up.size, keep, out, history, layer, on + + +@pytest.mark.independent_method +def test_moment_curvature_and_reversal_match_the_field_solver(loop): + # Q3, Q5: moment along the loop within 3e-3 of the full-slip moment, cycle + # dissipation within 2 %. + _, ref, path, n_up, _, out, history, layer, on = loop + m_ref = out.moment / (0.5 * ref.n_cores * ref.a_cr) + m_lib = history.moment_Nm[:, 0] / (layer.EI_stick * on) + full = m_ref[n_up - 1] + assert np.max(np.abs(m_lib - m_ref)) <= 3e-3 * full + w_ref = out.dissipation / (2.0 * math.pi * 0.5 * ref.n_cores * ref.a_cr**2) + w_lib = history.work.friction_J_per_m / (layer.EI_stick * on**2) + cycle_ref = w_ref[-1] - w_ref[n_up - 1] + cycle_lib = w_lib[-1] - w_lib[n_up - 1] + assert cycle_lib == pytest.approx(cycle_ref, rel=0.02) + + +@pytest.mark.independent_method +def test_friction_stress_distribution_matches_the_field_solver(loop): + # Q4: the axial friction force along the pitch at 1.03, 1.1, 1.2, 1.5 onset. + name, ref, path, _, keep, out, history, layer, on = loop + theta = out.segment_azimuth[0] + plateau = ref.b_a * math.pi / 2 + 2.0 * ref.b_c * min(math.pi / 3, math.pi / 2) + phi = layer.phi_wires + for index in keep[1:]: + n_ref = np.interp(phi, theta, out.forces[index][0], period=2 * math.pi) + n_lib = history.stress_Pa[:, index] / (layer.k_f * layer.r_helix_m * on) + n_lib = n_lib * ref.a_cr + diff = np.abs(n_lib - n_ref) + assert np.sqrt(np.mean(diff**2)) <= 1e-2 * plateau, (name, path[index]) + assert np.max(diff) <= 4e-2 * plateau, (name, path[index]) + + +@pytest.mark.independent_method +def test_onset_matches_the_field_solver(loop): + # Q1: no macroscopic slip of the rigid-contact limit at 0.98 onset, slip at + # 1.03 onset; the library onset is the absolute one. + _, ref, path, _, keep, out, history, layer, on = loop + theta = out.segment_azimuth + k = min(ref.k_a if ref.b_a > 0 else ref.k_c, ref.k_c if ref.b_c > 0 else ref.k_a) + for index, below in ((keep[0], True), (keep[1], False)): + a = path[index] * ref.a_cr + slip = np.max(np.abs(out.forces[index] - a * np.cos(theta))) + assert (slip < 20.0 / k) if below else (slip > 100.0 / k) + assert history.slipping_count[keep[0]] == 0 + assert history.slipping_count[keep[1]] > 0 + + +def _reference_full_slip(b_a: float, b_c: float) -> float: + """First curvature (units of onset) at which the reference tangent of the + moment falls below 1e-3 of the stick tangent.""" + ref = CoupledSlipReference(nodes=360, b_c=b_c, b_a=b_a) + a = np.concatenate( + [[0.95], np.arange(1.0, 1.15, 0.01), np.arange(1.15, 1.45, 0.002)] + ) + out = run_path(ref, a * ref.a_cr) + m = out.moment / (0.5 * ref.n_cores * ref.a_cr) + tangent = np.diff(m) / np.diff(a) + flat = np.flatnonzero(tangent < 1e-3) + return float(a[flat[0]]) + + +def _library_full_slip(share: float) -> float: + a = np.linspace(0.0, 1.6, 6401) + history, layer, on = _library(share, a, spc=120) + history = wire_slip_history( + layer, + a * on, + 0 * a, + coupling=StationCoupling( + 3, layer.mu * (1 - share), layer.mu, layer.contact_pressure_Pa * share + ), + direction_hold_fraction=0.0, + keep_cap=True, + ) + loaded = np.abs(np.cos(layer.phi_wires)) > 1e-9 + stress = np.abs(history.stress_Pa[loaded]) + on_bound = np.all(stress >= history.cap_Pa[loaded] * (1 - 1e-12), axis=0) + return float(a[np.argmax(on_bound)]) + + +@pytest.mark.independent_method +@pytest.mark.parametrize(("b_a", "b_c", "share"), [(0.0, 1.0, 1.0), (1.0, 0.5, 0.5)]) +def test_full_slip_curvature_matches_the_field_solver(b_a, b_c, share): + # Q2: within 1 %; the pure intralayer value is 2 pi / (3 sqrt 3). + reference = _reference_full_slip(b_a, b_c) + library = _library_full_slip(share) + assert library == pytest.approx(reference, rel=0.01) + if share == 1.0: + assert library == pytest.approx(FULL_SLIP_RATIO, rel=2e-3) + assert reference == pytest.approx(FULL_SLIP_RATIO, rel=0.01) + + +def _closed_form_profile(psi: np.ndarray, b_a: float, b_c: float, n: int = 3): + """Planar full-slip friction force at the angle ``psi`` from the neutral + axis: interlayer b_a psi plus intralayer 2 b_c min(psi, pi / n).""" + return b_a * psi + 2.0 * b_c * np.minimum(psi, math.pi / n) + + +@pytest.mark.independent_method +@pytest.mark.parametrize(("b_a", "b_c", "share"), [(0.0, 1.0, 1.0), (1.0, 0.5, 0.5)]) +def test_full_slip_profile_and_moment_closed_form(b_a, b_c, share): + # Q6: the frozen full-slip profile of the reference and of the library. + ref = CoupledSlipReference(nodes=360, b_c=b_c, b_a=b_a) + a = np.array([0.9, 1.2, 1.5, 1.8, 2.0]) * ref.a_cr + out = run_path(ref, a, keep=(4,)) + theta = out.segment_azimuth[0] + psi = np.arcsin(np.abs(np.cos(theta))) + profile = np.sign(np.cos(theta)) * _closed_form_profile(psi, b_a, b_c) + scale = float(np.max(np.abs(profile))) + assert np.max(np.abs(out.forces[4][0] - profile)) <= 1e-3 * scale + history, layer, on = _library(share, a / ref.a_cr) + psi_l = np.arcsin(np.abs(np.cos(layer.phi_wires))) + profile_l = np.sign(np.cos(layer.phi_wires)) * _closed_form_profile(psi_l, b_a, b_c) + n_lib = history.stress_Pa[:, -1] / (layer.k_f * layer.r_helix_m * on) * ref.a_cr + assert np.max(np.abs(n_lib - profile_l)) <= 1e-3 * scale + # Pure intralayer: sqrt(3)/2 of the uncoupled full-slip moment. + if share == 1.0: + uncoupled = 4.0 / math.pi + assert out.moment[-1] / (1.5 * ref.a_cr) == pytest.approx( + math.sqrt(3) / 2 * uncoupled, rel=1e-3 + ) + + +# --------------------------------------------------------------------------- # +# Limits # +# --------------------------------------------------------------------------- # +def _planar_and_biaxial(): + t = np.linspace(0.0, 2.0, 121) + return 2.0e-3 * np.sin(np.pi * t), 0.6e-3 * np.sin(2 * np.pi * t) + + +@pytest.mark.analytical_sanity +@pytest.mark.parametrize("contact_model", ["bounded", "solved"]) +def test_no_core_core_friction_gives_the_interlayer_law(cable, contact_model): + spec = CoreFrictionSpec(mu_core_core=0.0, filler_profiles=True) + kx, ky = _planar_and_biaxial() + absolute = build_core_friction(cable, spec, T, contact_model=contact_model) + relative = build_core_friction( + cable, + dataclasses.replace(spec, core_core_coupling="relative"), + T, + contact_model=contact_model, + ) + a = core_friction_history(absolute, kx, ky) + b = core_friction_history(relative, kx, ky) + scale = float(np.max(np.abs(a.moment_Nm))) + assert np.max(np.abs(a.moment_Nm - b.moment_Nm)) <= 1e-12 * scale + assert b.work.friction_J_per_m[-1] == pytest.approx( + a.work.friction_J_per_m[-1], rel=1e-12 + ) + + +@pytest.mark.analytical_sanity +def test_no_core_core_load_gives_the_absolute_law(cable): + # A central filler takes the inward core loads: no core-core contact. + spec = CoreFrictionSpec(central_filler=True) + absolute = build_core_friction(cable, spec, T) + relative = build_core_friction( + cable, dataclasses.replace(spec, core_core_coupling="relative"), T + ) + assert absolute.loads.core_core_N_per_m == 0.0 + kx, ky = _planar_and_biaxial() + a = core_friction_history(absolute, kx, ky) + b = core_friction_history(relative, kx, ky) + scale = float(np.max(np.abs(a.moment_Nm))) + assert np.max(np.abs(a.moment_Nm - b.moment_Nm)) <= 1e-12 * scale + + +@pytest.mark.analytical_sanity +def test_pure_intralayer_cores_reach_full_slip_at_the_coupled_ratio(cable): + spec = CoreFrictionSpec( + mu_core_filler=0.0, + mu_core_sheath=0.0, + core_core_coupling="relative", + n_stations_per_core=240, + ) + model = build_core_friction(cable, spec, T) + assert model.coupling is not None + assert model.coupling.interlayer_mu == 0.0 + on = slip_onset_curvature(model.population) + assert core_full_slip_curvature(model) / on == pytest.approx( + FULL_SLIP_RATIO, rel=2e-3 + ) + # Full-slip moment: sqrt(3)/2 of the uncoupled one with the same + # (linear) bound. + upper, lower, cap = coupled_slip_stress_bounds( + model.population, model.coupling, 0.0 + ) + psi = np.arcsin(np.abs(np.cos(model.population.phi_wires))) + linear = cap / np.minimum(psi, math.pi / 3).clip(1e-300) * psi + c = np.abs(np.cos(model.population.phi_wires)) + ratio = np.sum(cap * c) / np.sum(linear * c) + assert ratio == pytest.approx(math.sqrt(3) / 2, rel=1e-4) + weight = ( + model.population.A_wire_m2 + * math.cos(model.population.lay_angle_rad) + * model.population.r_helix_m + ) + assert core_full_slip_moment(model) == pytest.approx( + weight * np.sum(cap * c), rel=1e-12 + ) + + +@pytest.mark.analytical_sanity +def test_two_cores_slip_as_the_absolute_law_without_capstan(): + # Two cores slip relative to each other in the sense of their absolute slip. + layer = _population(2, 90) + on = slip_onset_curvature(layer) + a = np.concatenate([np.linspace(0, 3, 61), np.linspace(3, -3, 121)[1:]]) + coupled = wire_slip_history( + layer, + a * on, + 0.3 * a * on, + coupling=StationCoupling(2, 0.0, layer.mu, layer.contact_pressure_Pa), + ) + absolute = wire_slip_history(layer, a * on, 0.3 * a * on) + scale = float(np.max(np.abs(absolute.moment_Nm))) + lam = layer.mu * math.sin(layer.lay_angle_rad) + assert lam <= 2e-4 + assert np.max(np.abs(coupled.moment_Nm - absolute.moment_Nm)) <= 5 * lam * scale + + +@pytest.mark.analytical_sanity +def test_cables_without_laid_core_family_are_rejected_alike(): + single = cx.load_cable(cx.inter_array_single_core_yaml_path()) + messages = [] + for spec in (CoreFrictionSpec(), RELATIVE): + with pytest.raises(CableSchemaError) as error: + build_core_friction(single, spec, T) + messages.append(str(error.value)) + assert messages[0] == messages[1] + + +@pytest.mark.analytical_sanity +def test_stick_state_and_onset_are_those_of_the_absolute_law(cable): + absolute = build_core_friction(cable, CoreFrictionSpec(), T) + relative = build_core_friction(cable, RELATIVE, T) + assert relative.stick_EI_Nm2 == absolute.stick_EI_Nm2 + assert relative.xi == absolute.xi + on = slip_onset_curvature(absolute.population) + k = np.linspace(0.0, 0.95 * on, 20) + a = core_friction_history(absolute, k, 0 * k) + b = core_friction_history(relative, k, 0 * k) + assert np.max(np.abs(a.moment_Nm - b.moment_Nm)) <= 1e-12 * float( + np.max(np.abs(a.moment_Nm)) + ) + # The bounds a station holds in full slip: interlayer plus intralayer. + upper, lower = core_station_bounds(relative, 0.3) + u_a, l_a, cap = coupled_slip_stress_bounds( + relative.population, relative.coupling, 0.3 + ) + np.testing.assert_array_equal(upper, u_a + cap) + np.testing.assert_array_equal(lower, l_a + cap) + + +# --------------------------------------------------------------------------- # +# Default law unchanged # +# --------------------------------------------------------------------------- # +#: The default law on dev e9b3f8f (before the coupling option): moment +#: components at two samples, final friction work, and the same with a +#: tension-following load history (66 kV template, filler profiles). +GOLDEN = { + "bounded": ( + -51.667575888214344, + -5.9973057283196995, + 0.20684780454609583, + -99.55404704200525, + 0.1910175589473319, + ), + "solved": ( + -35.8886511509267, + -6.336827311759066, + 0.17858448424133866, + -72.95869295260198, + 0.17278280109502678, + ), +} + + +@pytest.mark.analytical_sanity +@pytest.mark.parametrize("contact_model", ["bounded", "solved"]) +def test_default_law_is_unchanged(cable, contact_model): + model = build_core_friction( + cable, CoreFrictionSpec(filler_profiles=True), T, contact_model=contact_model + ) + assert model.coupling is None + t = np.linspace(0.0, 2.0, 81) + kx = 1.5e-3 * np.sin(np.pi * t) + ky = 0.4e-3 * np.sin(2 * np.pi * t) + h = core_friction_history(model, kx, ky) + loads = core_load_history( + cable, model, 30e3 + 40e3 * t, contact_model=contact_model + ) + assert loads.core_intralayer_pressure_Pa is None + h2 = core_friction_history(model, kx, ky, loads=loads) + values = ( + float(h.moment_Nm[40, 0]), + float(h.moment_Nm[60, 1]), + float(h.work.friction_J_per_m[-1]), + float(h2.moment_Nm[50, 0]), + float(h2.work.friction_J_per_m[-1]), + ) + # The solved trefoil comes from an iterative radial solve, which converges + # to its own tolerance (the compiled and the plain build differ by a few + # 1e-9); the bounded chain is closed form. + rtol = 1e-12 if contact_model == "bounded" else 1e-7 + np.testing.assert_allclose(values, GOLDEN[contact_model], rtol=rtol, atol=0) + # In the same run the default core law is the independent-station + # update, bit for bit. + direct = wire_slip_history( + model.population, + kx, + ky, + direction_hold_fraction=model.spec.direction_hold_fraction, + ) + np.testing.assert_array_equal(h.core_moment_Nm, direct.moment_Nm) + station = core_station_history(model, kx, ky) + np.testing.assert_array_equal(station.stress_Pa, direct.stress_Pa) + assert core_full_slip_moment(model) > 0.0 + + +# --------------------------------------------------------------------------- # +# Return map: compiled and NumPy paths # +# --------------------------------------------------------------------------- # +def _random_groups(rng, groups: int, n: int): + upper = rng.uniform(0.0, 1.0, (groups, n)) * (rng.random((groups, n)) > 0.2) + lower = upper * rng.uniform(0.5, 1.0, (groups, n)) + cap = rng.uniform(0.0, 1.5, (groups, n)) * (rng.random((groups, n)) > 0.1) + trial = rng.normal(0.0, 2.0, (groups, n)) + return trial, upper, lower, cap + + +def _stations(x: np.ndarray) -> np.ndarray: + return np.ascontiguousarray(x.T).reshape(-1) + + +@pytest.mark.analytical_sanity +@pytest.mark.parametrize("n", [2, 3, 4]) +def test_compiled_and_numpy_return_maps_agree_and_are_optimal(n): + rng = np.random.default_rng(7 + n) + trial, upper, lower, cap = _random_groups(rng, 400, n) + args = [_stations(x) for x in (trial, upper, lower, cap)] + fast = project_station_groups(*args, n, compiled=True) + slow = project_station_groups(*args, n, compiled=False) + scale = float(np.max(np.abs(args[0]))) + assert np.max(np.abs(fast - slow)) <= 1e-12 * scale + s = group_view(slow, n) + # Admissible: a decomposition a + c with sum(c) = 0 exists, and the result + # is the closest admissible point (variational inequality against random + # admissible points). + lo_c = np.maximum(s - upper, -cap) + hi_c = np.minimum(s + lower, cap) + tol = 1e-12 * scale + assert np.all(lo_c <= hi_c + tol) + assert np.all(lo_c.sum(axis=1) <= tol) + assert np.all(hi_c.sum(axis=1) >= -tol) + for _ in range(20): + a = rng.uniform(-lower, upper) + c = rng.uniform(-cap, cap) + c -= c.mean(axis=1, keepdims=True) + inside = np.all(np.abs(c) <= cap, axis=1) + y = a + c + inner = np.sum((trial - s) * (y - s), axis=1) + assert np.all(inner[inside] <= 1e-10 * scale**2) + # A point that is admissible is its own projection. + again = project_station_groups(_stations(s), *args[1:], n, compiled=False) + assert np.max(np.abs(again - slow)) <= 1e-12 * scale + + +@pytest.mark.analytical_sanity +def test_core_history_is_the_same_on_both_return_maps(cable, monkeypatch): + model = build_core_friction(cable, RELATIVE, T) + kx, ky = _planar_and_biaxial() + monkeypatch.setattr(station_coupling, "HAVE_NUMBA", True) + fast = core_friction_history(model, kx, ky) + monkeypatch.setattr(station_coupling, "HAVE_NUMBA", False) + slow = core_friction_history(model, kx, ky) + scale = float(np.max(np.abs(slow.moment_Nm))) + assert np.max(np.abs(fast.moment_Nm - slow.moment_Nm)) <= 1e-12 * scale + assert np.max(np.abs(fast.work.friction_J_per_m - slow.work.friction_J_per_m)) <= ( + 1e-12 * float(np.max(np.abs(slow.work.friction_J_per_m))) + ) + + +# --------------------------------------------------------------------------- # +# Routes and inputs # +# --------------------------------------------------------------------------- # +def test_relative_law_lowers_the_slip_moment_and_keeps_energy(cable): + absolute = build_core_friction(cable, CoreFrictionSpec(), T) + relative = build_core_friction(cable, RELATIVE, T) + assert relative.loads.core_core_N_per_m > 0.0 + on = slip_onset_curvature(absolute.population) + k = np.concatenate([np.linspace(0, 6 * on, 121), np.linspace(6 * on, -6 * on, 241)]) + a = core_friction_history(absolute, k, 0 * k) + b = core_friction_history(relative, k, 0 * k) + assert abs(b.core_moment_Nm[120, 0]) < abs(a.core_moment_Nm[120, 0]) + assert core_full_slip_moment(relative) == pytest.approx( + abs(b.core_moment_Nm[120, 0]), rel=1e-9 + ) + assert core_full_slip_curvature(relative) < core_full_slip_curvature(absolute) + balance = b.work.balance_residual_J_per_m + assert np.max(np.abs(balance)) <= 1e-9 * float(np.max(b.work.endpoint_work_J_per_m)) + assert np.all(np.diff(b.work.friction_J_per_m) >= -1e-15) + + +def test_relative_load_history_follows_the_core_core_load(cable): + model = build_core_friction(cable, RELATIVE, T) + tension = np.linspace(10e3, 120e3, 50) + loads = core_load_history(cable, model, tension) + assert loads.core_intralayer_pressure_Pa is not None + reference = model.coupling.intralayer_pressure_Pa + i = int(np.argmin(np.abs(tension - T))) + assert loads.core_intralayer_pressure_Pa[i] == pytest.approx(reference, rel=0.05) + assert np.all(np.diff(loads.core_intralayer_pressure_Pa) > 0.0) + on = slip_onset_curvature(model.population) + k = np.linspace(0.0, 5 * on, 50) + held = core_friction_history(model, k, 0 * k) + follow = core_friction_history(model, k, 0 * k, loads=loads) + assert abs(follow.core_moment_Nm[-1, 0]) > abs(held.core_moment_Nm[-1, 0]) + # A history of the absolute law does not fit the relative model, and back. + absolute = build_core_friction(cable, CoreFrictionSpec(), T) + other = core_load_history(cable, absolute, tension) + for m, h in ((model, other), (absolute, loads)): + with pytest.raises(CableInputError, match="core-core coupling differs"): + core_friction_history(m, k, 0 * k, loads=h) + + +def test_relative_load_history_with_an_unloaded_interlayer_reference(cable): + # Interlayer coefficient zero at the reference, positive later: the + # pressure is normalised by the most loaded sample. + spec = CoreFrictionSpec(mu_core_sheath=0.0, core_core_coupling="relative") + model = build_core_friction(cable, dataclasses.replace(spec, mu_core_filler=0.0), T) + assert model.coupling.interlayer_mu == 0.0 + loads = core_load_history(cable, dataclasses.replace(model, spec=spec), [T, 2 * T]) + assert loads.core_mu_capstan > 0.0 + assert np.all(np.isfinite(loads.core_pressure_Pa)) + + +def test_relative_law_is_direction_tied(cable): + model = build_core_friction(cable, RELATIVE, T) + t = np.linspace(0.0, 2 * np.pi, 60) + on = slip_onset_curvature(model.population) + kx, ky = 3 * on * np.cos(t), 3 * on * np.sin(t) + with pytest.raises(CableInputError, match="direction-tied law"): + core_friction_history(model, kx, ky, friction_model="distributed") + with pytest.warns(FrictionModelFallbackWarning, match="relative core-core"): + auto = core_friction_history(model, kx, ky, friction_model="auto") + assert auto.friction_model == "direction_tied" + with warnings.catch_warnings(): + warnings.simplefilter("error") + planar = core_friction_history(model, kx, 0 * ky, friction_model="auto") + assert planar.friction_model == "direction_tied" + + +def test_relative_specification_and_station_inputs(): + with pytest.raises(CableInputError, match="core_core_coupling"): + CoreFrictionSpec(core_core_coupling="neighbours") # type: ignore[arg-type] + for bad in ( + {"group_size": 1}, + {"group_size": True}, + {"interlayer_mu": -0.1}, + {"intralayer_pressure_Pa": math.inf}, + ): + values = { + "group_size": 3, + "interlayer_mu": 0.1, + "intralayer_mu": 0.2, + "intralayer_pressure_Pa": 1.0, + } + values.update(bad) + with pytest.raises(CableInputError): + StationCoupling(**values) + with pytest.raises(CableInputError, match="groups of 3"): + group_view(np.zeros(10), 3) + layer = _population(3, 4) + coupling = StationCoupling(3, 0.1, 0.2, 1e5) + k = np.linspace(0.0, 1e-3, 5) + with pytest.raises(CableInputError, match="friction law"): + wire_slip_history( + layer, + k, + k, + coupling=coupling, + friction_law=cx.FrictionLaw(static_factor=1.2, stick_time_s=0.0), + time_s=np.arange(5.0), + ) + with pytest.raises(CableInputError, match="needs a station coupling"): + wire_slip_history(layer, k, k, intralayer_pressure_Pa=np.ones(5)) + with pytest.raises(CableInputError, match="groups of 5"): + wire_slip_history( + _population(1, 12), k, k, coupling=StationCoupling(5, 0.1, 0.2, 1.0) + ) + with pytest.raises(CableInputError, match="intralayer pressure must"): + wire_slip_history(layer, k, k, coupling=coupling, intralayer_pressure_Pa=[1.0]) + with pytest.raises(CableInputError, match="nonnegative intralayer"): + wire_slip_history( + layer, k, k, coupling=coupling, intralayer_pressure_Pa=-np.ones(5) + ) + # Zero intralayer friction gives no intralayer bound; keep_cap reports + # the station bound of the side of the stress. + upper, lower, cap = coupled_slip_stress_bounds( + layer, dataclasses.replace(coupling, intralayer_mu=0.0), 0.0 + ) + assert not np.any(cap) + history = wire_slip_history( + layer, + 5 * k, + 0 * k, + coupling=coupling, + keep_cap=True, + direction_hold_fraction=0.0, + ) + assert history.cap_Pa is not None + assert np.all(np.abs(history.stress_Pa) <= history.cap_Pa * (1 + 1e-12)) + # Below the direction threshold the three bounds are blended. + tiny = wire_slip_history(layer, 1e-9 * k, 1e-9 * k[::-1], coupling=coupling) + assert np.all(tiny.slipping_count == 0) + + +def test_relative_routes_of_the_section(cable): + from cablexsec.analysis.components import _core_axis + from cablexsec.mechanics.core_kinematics import core_kinematics + from cablexsec.mechanics.section_state import solve_section_state + + on = slip_onset_curvature(build_core_friction(cable, RELATIVE, T).population) + k = np.linspace(0.0, 4 * on, 40) + for spec in (CoreFrictionSpec(), RELATIVE): + kin = core_kinematics( + cable, + k, + 0.2 * k, + state="frictional", + core_friction=spec, + contact_tension_N=T, + ) + assert kin.slipping is not None and kin.slipping[:, -1].any() + state = solve_section_state(cable, tension_N=T, contact_model="bounded") + layer = next(x for x in cable.layers if getattr(x, "r_offset_m", None)) + absolute = _core_axis(cable, layer, state, 4 * on, 0.0, CoreFrictionSpec()) + relative = _core_axis(cable, layer, state, 4 * on, 0.0, RELATIVE) + assert "relative core-core slip" in relative.note + np.testing.assert_allclose(relative.stuck, absolute.stuck) + # The core on the extreme fibre holds the plateau of the coupled profile. + assert abs(relative.frictional[0]) < abs(absolute.frictional[0]) + zero = _core_axis(cable, layer, state, 0.0, 0.0, RELATIVE) + assert not np.any(zero.frictional) + + +def test_coupled_stations_with_contact_shape_and_changing_stiffness(): + layer = _population(3, 8) + shaped = dataclasses.replace(layer, shape_g=np.ones(layer.n_wires)) + coupling = StationCoupling(3, 0.1, 0.2, 5e4) + for part, other in zip( + coupled_slip_stress_bounds(layer, coupling, 0.4), + coupled_slip_stress_bounds(shaped, coupling, 0.4), + strict=True, + ): + np.testing.assert_array_equal(part, other) + on = slip_onset_curvature(layer) + a = np.concatenate([np.linspace(0, 4, 41), np.linspace(4, -4, 81)[1:]]) + stiffness = layer.k_f * np.linspace(1.0, 0.8, a.size) + history = wire_slip_history( + shaped, a * on, 0.2 * a * on, coupling=coupling, stick_modulus_Pa=stiffness + ) + scale = float(np.max(np.abs(history.work.endpoint_work_J_per_m))) + assert np.max(np.abs(history.work.balance_residual_J_per_m)) <= 1e-9 * scale + assert np.any(history.material_work_J_per_m != 0.0) + + +def test_coupled_full_slip_curvature_inputs(cable): + free = CoreFrictionSpec( + mu_core_filler=0.0, + mu_core_core=0.0, + mu_core_sheath=0.0, + core_core_coupling="relative", + ) + model = build_core_friction(cable, free, T) + assert core_full_slip_curvature(model) == 0.0 + with pytest.raises(CableInputError, match="finite"): + core_full_slip_curvature(build_core_friction(cable, RELATIVE, T), math.nan) + absolute = build_core_friction(cable, CoreFrictionSpec(), T) + upper, lower = core_station_bounds(absolute, 0.2) + from cablexsec.mechanics.papailiou import wire_slip_stress_bounds + + reference = wire_slip_stress_bounds(absolute.population, 0.2) + np.testing.assert_array_equal(upper, reference[0]) + np.testing.assert_array_equal(lower, reference[1]) diff --git a/tests/test_core_screens_sheaths.py b/tests/test_core_screens_sheaths.py index f908259..4496e30 100644 --- a/tests/test_core_screens_sheaths.py +++ b/tests/test_core_screens_sheaths.py @@ -267,8 +267,16 @@ def test_stuck_core_adds_the_axis_strain_to_the_screen(thies): assert free.axis_strain_range[0] == 0.0 assert np.max(stuck.stress_range_Pa) > 3 * np.max(free.stress_range_Pa) assert np.any(stuck.exceeds_yield) - # The axis strain is common to the core layers: no extra slip. - assert np.allclose(stuck.slip_amplitude_m, free.slip_amplitude_m, rtol=1e-12) + # The axis strain is common to the core layers: no extra slip. The stuck + # core bends with the normal curvature cos^4(beta) instead of the free + # cos^2(beta) cos(2 beta) (the normal curvature follows the core slip + # state), so the screen slip grows at most by cos^2(beta) / cos(2 beta). + moving = free.slip_amplitude_m > 0.0 + assert np.array_equal(moving, stuck.slip_amplitude_m > 0.0) + ratio = stuck.slip_amplitude_m[moving] / free.slip_amplitude_m[moving] + assert np.all(ratio >= 1.0 - 1e-12) + assert np.all(ratio <= math.cos(beta) ** 2 / math.cos(2 * beta) * (1 + 1e-12)) + assert np.any(ratio > 1.0 + 1e-6) def test_thies_screen_reproduces_the_core_level_workaround(aligned): diff --git a/tests/test_helical_bending_geometry.py b/tests/test_helical_bending_geometry.py index d02bc20..19f636d 100644 --- a/tests/test_helical_bending_geometry.py +++ b/tests/test_helical_bending_geometry.py @@ -104,16 +104,23 @@ def test_armour_stress_extrema_include_all_fibres_not_only_the_radial_fibre(): result.sigma_A_Pa[name] + result.sigma_f_Pa[name] + result.sigma_T_Pa[name] ) angles = np.radians(result.phi_deg[name]) - math.atan2(ky, kx) - direct = np.array( - [np.linalg.norm(_gradient(layer.lay_angle_rad, p)) for p in angles] + e = library.get_property(layer.material, "E_Pa") + kappa = math.hypot(kx, ky) + # The curve curvature of the bent helix, whose normal component gains + # the term of each wire's slip state, (sin^2 a / r) sigma_f / E. + slip = ( + math.sin(layer.lay_angle_rad) ** 2 + / layer.r_helix_m + * result.sigma_f_Pa[name] + / (e * kappa) ) - amplitude = ( - direct - * library.get_property(layer.material, "E_Pa") - * math.hypot(kx, ky) - * layer.d_wire_m - / 2 + direct = np.array( + [ + np.linalg.norm(_gradient(layer.lay_angle_rad, p) + np.array([s, 0.0])) + for p, s in zip(angles, slip, strict=True) + ] ) + amplitude = direct * e * kappa * layer.d_wire_m / 2 np.testing.assert_allclose( result.sigma_perimeter_min_Pa[name], mean - amplitude, rtol=1e-7, atol=0.01 ) diff --git a/tests/test_kinematics.py b/tests/test_kinematics.py index f84d962..a9fa95d 100644 --- a/tests/test_kinematics.py +++ b/tests/test_kinematics.py @@ -305,7 +305,8 @@ def test_utilisation_is_the_largest_fibre_over_yield() -> None: limit = library.get_property(material, "sigma_y_Pa") largest = np.abs(layer.stress_Pa) + layer.bending_Pa np.testing.assert_allclose(layer.utilisation, largest / limit, rtol=1e-12) - # The local bending is that of the stress route at the outer fibres. + # The local bending is that of the stress route at the outer fibres, its + # normal curvature following the friction stress of each station. spec = cable_to_mkappa_specs(CABLE, 80e3)[0] diameter = 2 * math.sqrt(spec.A_wire_m2 / math.pi) radial = local_bending_fibre_stress( @@ -315,6 +316,8 @@ def test_utilisation_is_the_largest_fibre_over_yield() -> None: spec.E_wire_Pa, diameter, spec.lay_angle_rad, + friction_stress_Pa=layer.friction_Pa, + r_helix_m=spec.r_helix_m, ) tangential = local_bending_fibre_stress( CYCLE[None, :], @@ -324,6 +327,8 @@ def test_utilisation_is_the_largest_fibre_over_yield() -> None: diameter, spec.lay_angle_rad, math.pi / 2, + friction_stress_Pa=layer.friction_Pa, + r_helix_m=spec.r_helix_m, ) np.testing.assert_allclose(layer.bending_Pa, np.hypot(radial, tangential)) diff --git a/tests/test_normal_term_slip_state.py b/tests/test_normal_term_slip_state.py new file mode 100644 index 0000000..7952dcb --- /dev/null +++ b/tests/test_normal_term_slip_state.py @@ -0,0 +1,458 @@ +# SPDX-License-Identifier: Apache-2.0 +# Copyright (c) 2026 Jae Hoon Seo, SMI Lab, Inha University +"""The normal wire curvature follows the wire's axial slip state. + +On the deformed helix the normal (weak-axis) curvature change is +``cos^2 a cos 2a p_n`` per unit current length; the wire's bending strain is +its cross-section rotation per unit material length, which adds +``(sin^2 a / r) eps_w`` of the axial strain ``eps_w = sigma_f / E`` the wire +carries (``mechanics.wire_stress`` module notes). The analytical limits: + +* stuck wire with the plane-section strain (``xi = 1``): ``cos^4 a``; +* stuck with the shear-lag coefficient ``xi``: + ``cos^2 a cos 2a + xi sin^2 a cos^2 a``; +* no friction stress (``mu = 0``): ``cos^2 a cos 2a`` + ([MenardCartraud2023] Eq. 14); +* Coulomb slip: slope ``cos^2 a cos 2a``, offset of the friction stress. + +The lateral (in-surface) term ``cos a (1 + sin^2 a)`` is unchanged. +""" + +from __future__ import annotations + +import math +import warnings + +import numpy as np +import pytest + +import cablexsec as cx +import cablexsec.analysis.fatigue as fatigue +from cablexsec.analysis.capacity import _local_bending_max +from cablexsec.analysis.fast_field import assemble_wire_field +from cablexsec.analysis.fatigue import FatigueLayer, wire_stress_field +from cablexsec.exceptions import CableInputError +from cablexsec.materials import library +from cablexsec.materials.sn_curves import SN_CURVES +from cablexsec.mechanics.core_kinematics import core_kinematics +from cablexsec.mechanics.mkappa import HelicalLayerSpec +from cablexsec.mechanics.strand_slip import ( + ConductorRing, + conductor_ring_parameters, + strand_slip_strain, +) +from cablexsec.mechanics.wire_stress import ( + local_bending_amplitude, + local_bending_fibre_stress, + local_bending_stress, + slip_state_normal_curvature, +) + +pytestmark = pytest.mark.analytical_sanity + +ANGLES_DEG = (10.0, 20.1, 35.0) +E_W = 200e9 +R_H = 0.05 +D_W = 0.004 + + +def _spec(alpha_deg: float, xi: float = 1.0, mu: float = 50.0) -> HelicalLayerSpec: + return HelicalLayerSpec( + n_wires=16, + r_helix_m=R_H, + lay_angle_rad=math.radians(alpha_deg), + E_wire_Pa=E_W, + A_wire_m2=math.pi * (D_W / 2) ** 2, + xi=xi, + mu=mu, + F_n_axi_N=2e3, + contact_pressure_Pa=2e5, + ) + + +def _layer(spec: HelicalLayerSpec) -> FatigueLayer: + return FatigueLayer( + spec=spec, sn_bulk=SN_CURVES["dnv_rpc203_t_curve"], sigma_UTS_Pa=1e9 + ) + + +def _ratio(field, spec: HelicalLayerSpec, kx: np.ndarray) -> np.ndarray: + """Outer-face bending over ``E (d/2) p_n`` where ``|p_n|`` is not small.""" + p_n = np.cos(spec.phi_wires)[:, None] * kx[None, :] + mask = np.abs(p_n) > 0.05 * np.abs(p_n).max() + return np.asarray(field.radial_Pa[mask] / (E_W * D_W / 2 * p_n[mask])) + + +def _coefficients(alpha_deg: float) -> tuple[float, float]: + a = math.radians(alpha_deg) + return math.cos(a), math.sin(a) + + +def test_slip_state_normal_curvature_is_the_initial_curvature_times_the_strain(): + a = math.radians(20.1) + value = slip_state_normal_curvature(np.array([3e7, -2e7]), E_W, a, R_H) + expected = math.sin(a) ** 2 / R_H * np.array([3e7, -2e7]) / E_W + np.testing.assert_allclose(value, expected, rtol=1e-15, atol=0) + for radius in (0.0, -1.0, math.inf, math.nan): + with pytest.raises(CableInputError, match="helix radius"): + slip_state_normal_curvature(1e7, E_W, a, radius) + with pytest.raises(CableInputError, match="r_helix_m"): + local_bending_fibre_stress(0.01, 0.0, 0.0, E_W, D_W, a, friction_stress_Pa=1e7) + + +@pytest.mark.parametrize("alpha_deg", ANGLES_DEG) +@pytest.mark.parametrize("fast", [True, False]) +def test_stuck_wire_takes_cos4(monkeypatch, alpha_deg, fast): + # Monotonic ramp far below the slip onset: every wire sticks with the + # plane-section strain (xi = 1). + monkeypatch.setattr(fatigue, "_FAST_FIELD", fast) + spec = _spec(alpha_deg) + kx = np.linspace(0.0, 1e-3, 11) + field = wire_stress_field(_layer(spec), kx, np.zeros_like(kx), keep_friction=True) + assert field.friction_Pa is not None + stick = spec.k_f * R_H * np.cos(spec.phi_wires)[:, None] * kx[None, :] + np.testing.assert_allclose(field.friction_Pa, stick, rtol=1e-12, atol=1e-6) + c, _s = _coefficients(alpha_deg) + np.testing.assert_allclose(_ratio(field, spec, kx), c**4, rtol=1e-12, atol=0) + + +@pytest.mark.parametrize("alpha_deg", ANGLES_DEG) +@pytest.mark.parametrize("xi", [0.35, 0.8]) +def test_stuck_wire_with_shear_lag_carries_xi_of_the_correction(alpha_deg, xi): + spec = _spec(alpha_deg, xi=xi) + kx = np.linspace(0.0, 1e-3, 11) + field = wire_stress_field(_layer(spec), kx, np.zeros_like(kx)) + c, s = _coefficients(alpha_deg) + expected = c * c * math.cos(2 * math.radians(alpha_deg)) + xi * s * s * c * c + np.testing.assert_allclose(_ratio(field, spec, kx), expected, rtol=1e-12, atol=0) + + +@pytest.mark.parametrize("alpha_deg", ANGLES_DEG) +@pytest.mark.parametrize("model", ["direction_tied", "distributed", "progressive"]) +def test_frictionless_wire_keeps_the_deformed_helix_value(alpha_deg, model): + spec = _spec(alpha_deg, mu=0.0) + kx = 0.01 * np.sin(np.linspace(0.0, 6.0, 40)) + ky = 0.004 * np.cos(np.linspace(0.0, 5.0, 40)) + with warnings.catch_warnings(): + warnings.simplefilter("ignore") + field = wire_stress_field(_layer(spec), kx, ky, friction_model=model) + legacy = local_bending_fibre_stress( + kx, ky, spec.phi_wires[:, None], E_W, D_W, spec.lay_angle_rad + ) + scale = float(np.abs(legacy).max()) + np.testing.assert_allclose(field.radial_Pa, legacy, rtol=0, atol=1e-12 * scale) + c, _s = _coefficients(alpha_deg) + ratio = _ratio(wire_stress_field(_layer(spec), kx, 0 * kx), spec, kx) + np.testing.assert_allclose( + ratio, c * c * math.cos(2 * math.radians(alpha_deg)), rtol=1e-12, atol=0 + ) + + +def _cyclic(n: int = 400) -> tuple[np.ndarray, np.ndarray]: + # Amplitude well above the onset, off the sample grid at every transition. + t = np.linspace(0.0, 3.0, n) + return 0.031 * np.sin(2 * np.pi * t + 0.17), 0.0071 * np.cos(2 * np.pi * t) + + +@pytest.mark.parametrize("model", ["direction_tied", "distributed", "progressive"]) +@pytest.mark.parametrize("fast", [True, False]) +def test_partial_slip_adds_the_term_of_the_carried_friction_stress( + monkeypatch, model, fast +): + monkeypatch.setattr(fatigue, "_FAST_FIELD", fast) + spec = _spec(20.1, xi=0.8, mu=0.15) + kx, ky = _cyclic() + with warnings.catch_warnings(): + warnings.simplefilter("ignore") + field = wire_stress_field( + _layer(spec), kx, ky, friction_model=model, keep_friction=True + ) + assert field.friction_Pa is not None + legacy = local_bending_fibre_stress( + kx, ky, spec.phi_wires[:, None], E_W, D_W, spec.lay_angle_rad + ) + s2 = math.sin(spec.lay_angle_rad) ** 2 + expected = legacy + D_W / 2 * s2 / R_H * field.friction_Pa + scale = float(np.abs(field.radial_Pa).max()) + np.testing.assert_allclose(field.radial_Pa, expected, rtol=0, atol=1e-12 * scale) + # The term is not negligible in this history. + assert np.abs(field.radial_Pa - legacy).max() > 1e-3 * scale + + +def test_stick_and_slip_segments_take_their_own_slopes(): + # Direction-tied spring-slider on a planar history: a step is stick when + # the friction increment is the elastic increment k_f r dp_n, slip when + # the friction stress holds its cap. + xi = 0.8 + spec = _spec(20.1, xi=xi, mu=0.15) + t = np.linspace(0.0, 3.0, 601) + kx = 0.031 * np.sin(2 * np.pi * t + 0.17) + field = wire_stress_field(_layer(spec), kx, 0 * kx, keep_friction=True) + assert field.friction_Pa is not None + p_n = np.cos(spec.phi_wires)[:, None] * kx[None, :] + dp = np.diff(p_n, axis=1) + df = np.diff(field.friction_Pa, axis=1) + dr = np.diff(field.radial_Pa, axis=1) / (E_W * D_W / 2) + big = np.abs(dp) > 1e-6 + stick = big & (np.abs(df - spec.k_f * R_H * dp) <= 1e-9 * spec.k_f * R_H * 0.03) + slip = big & (np.abs(df) <= 1e-9 * spec.k_f * R_H * 0.03) + assert stick.sum() > 50 and slip.sum() > 50 + c, s = _coefficients(20.1) + lox = c * c * math.cos(2 * math.radians(20.1)) + np.testing.assert_allclose( + dr[stick] / dp[stick], lox + xi * s * s * c * c, rtol=1e-9 + ) + np.testing.assert_allclose(dr[slip] / dp[slip], lox, rtol=1e-9) + + +def test_tangential_term_is_unchanged(): + spec = _spec(35.0, xi=0.8, mu=0.15) + kx, ky = _cyclic(200) + field = wire_stress_field(_layer(spec), kx, ky) + legacy = local_bending_fibre_stress( + kx, ky, spec.phi_wires[:, None], E_W, D_W, spec.lay_angle_rad, math.pi / 2 + ) + scale = float(np.abs(legacy).max()) + np.testing.assert_allclose(field.tangential_Pa, legacy, rtol=0, atol=1e-12 * scale) + + +def test_assembly_with_friction_and_increment_equals_the_numpy_expressions(): + rng = np.random.default_rng(3) + n_w, n_t = 6, 70 + kx, ky = rng.normal(0, 0.01, n_t), rng.normal(0, 0.005, n_t) + phi = np.linspace(0, 2 * math.pi, n_w, endpoint=False) + friction = rng.normal(0, 4e7, (n_w, n_t)) + extra = rng.normal(0, 1e7, (n_w, n_t)) + modulus = 200e9 * (1 + 0.02 * np.sin(np.linspace(0, 4, n_t))) + axial, thermal = rng.normal(0, 1e7, n_t), rng.normal(0, 1e6, n_t) + mean, radial, tangential = assemble_wire_field( + kx, ky, phi, modulus, D_W, 0.006, 0.3, axial, friction, thermal, extra, R_H + ) + held = friction + extra + radial_ref = local_bending_fibre_stress( + kx, ky, phi[:, None], modulus, D_W, 0.3, friction_stress_Pa=held, r_helix_m=R_H + ) + edge_ref = local_bending_fibre_stress( + kx, + ky, + phi[:, None], + modulus, + 0.006, + 0.3, + math.pi / 2, + friction_stress_Pa=held, + r_helix_m=R_H, + ) + mean_ref = axial[None, :] + friction + thermal[None, :] + extra + scale = float(np.abs(mean_ref).max()) + np.testing.assert_allclose(radial, radial_ref, rtol=0, atol=1e-12 * scale) + np.testing.assert_allclose(tangential, edge_ref, rtol=0, atol=1e-12 * scale) + np.testing.assert_allclose(mean, mean_ref, rtol=0, atol=1e-12 * scale) + with pytest.raises(CableInputError, match="helix radius"): + assemble_wire_field( + kx, ky, phi, modulus, D_W, 0.006, 0.3, axial, friction, thermal, None, 0.0 + ) + + +def test_termination_increment_enters_the_carried_stress(monkeypatch): + from cablexsec.analysis.termination import TerminationSpec # noqa: PLC0415 + + spec = _spec(20.1, xi=0.8, mu=0.15) + kx, ky = _cyclic(120) + term = TerminationSpec( + distance_m=0.5, segments_per_pitch=8, max_increment=2.0, reach_lengths=1.0 + ) + for fast in (True, False): + monkeypatch.setattr(fatigue, "_FAST_FIELD", fast) + with warnings.catch_warnings(): + warnings.simplefilter("ignore") + field = wire_stress_field( + _layer(spec), kx, ky, termination=term, keep_friction=True + ) + assert field.termination is not None and field.termination.applied + assert field.friction_Pa is not None # sectional plus increment + legacy = local_bending_fibre_stress( + kx, ky, spec.phi_wires[:, None], E_W, D_W, spec.lay_angle_rad + ) + s2 = math.sin(spec.lay_angle_rad) ** 2 + expected = legacy + D_W / 2 * s2 / R_H * field.friction_Pa + scale = float(np.abs(field.radial_Pa).max()) + np.testing.assert_allclose( + field.radial_Pa, expected, rtol=0, atol=1e-12 * scale + ) + + +def test_scalar_helpers_add_the_slip_state_term(): + a = math.radians(20.1) + c, s = math.cos(a), math.sin(a) + phi = np.linspace(0, 2 * math.pi, 9, endpoint=False) + kappa = 0.02 + sigma = 4e7 * np.cos(phi) + slip = s * s / R_H * sigma / E_W + normal = kappa * c * c * math.cos(2 * a) * np.cos(phi) + slip + stress = local_bending_stress( + kappa, phi, E_W, D_W, a, friction_stress_Pa=sigma, r_helix_m=R_H + ) + np.testing.assert_allclose(stress, E_W * D_W / 2 * normal, rtol=1e-13, atol=0) + amplitude = local_bending_amplitude( + kappa, phi, E_W, D_W, a, friction_stress_Pa=sigma, r_helix_m=R_H + ) + lateral = kappa * c * (1 + s * s) * np.sin(phi) + np.testing.assert_allclose( + amplitude, E_W * D_W / 2 * np.hypot(normal, lateral), rtol=1e-13, atol=0 + ) + # Without a friction stress: the unchanged Eq. 14 helpers. + assert np.array_equal( + local_bending_amplitude(-kappa, phi, E_W, D_W, a), + local_bending_amplitude(kappa, phi, E_W, D_W, a), + ) + + +def test_stress_route_follows_the_slip_front(): + cable = cx.load_cable(cx.menard2023_yaml_path()) + for mu in (0.0, None): + result = cx.compute_stress(cable, 0.03, 0.01, tension_N=1e4, mu=mu) + for name, sigma_b in result.sigma_B_Pa.items(): + layer = cable.get_layer(name) + a = layer.lay_angle_rad + assert a is not None and layer.r_helix_m is not None + e = library.get_property(layer.material, "E_Pa") + phi = np.radians(result.phi_deg[name]) + theta = phi - math.atan2(0.01, 0.03) + kappa = math.hypot(0.03, 0.01) + expected = ( + e + * layer.d_wire_m + / 2 + * ( + kappa * math.cos(a) ** 2 * math.cos(2 * a) * np.cos(theta) + + math.sin(a) ** 2 / layer.r_helix_m * result.sigma_f_Pa[name] / e + ) + ) + scale = float(np.abs(expected).max()) + np.testing.assert_allclose(sigma_b, expected, rtol=0, atol=1e-12 * scale) + if mu == 0.0: + assert np.all(result.sigma_f_Pa[name] == 0.0) + + +def test_capacity_bending_adds_the_slip_state_term(): + cable = cx.load_cable(cx.menard2023_yaml_path()) + layer = next( + x for x in cable.helical_layers if getattr(x, "wire_shape", None) == "round" + ) + a = layer.lay_angle_rad + assert a is not None and layer.r_helix_m is not None + phi = np.linspace(0, 2 * math.pi, 12, endpoint=False) + sigma = 3e7 * np.sign(np.cos(phi)) + got = _local_bending_max( + layer, 0.05, phi, E_W, a, 0.0, friction_stress_Pa=sigma, r_helix_m=0.06 + ) + ref = local_bending_amplitude( + 0.05, phi, E_W, layer.d_wire_m, a, friction_stress_Pa=sigma, r_helix_m=0.06 + ) + np.testing.assert_allclose(got, ref, rtol=1e-15, atol=0) + plain = _local_bending_max(layer, 0.05, phi, E_W, a, 0.0) + assert np.all(got[np.cos(phi) > 0.1] > plain[np.cos(phi) > 0.1]) + + +def test_capacity_rectangular_face_adds_the_slip_state_term(): + rect = cx.load_cable(cx.saevik2011_yaml_path("rectangular")) + layer = next(x for x in rect.helical_layers if x.wire_shape != "round") + a = layer.lay_angle_rad + assert a is not None + section = layer.wire_section + phi = np.linspace(0, 2 * math.pi, 12, endpoint=False) + sigma = 3e7 * np.cos(phi) + got = _local_bending_max( + layer, 0.05, phi, E_W, a, 0.0, friction_stress_Pa=sigma, r_helix_m=0.1 + ) + c, s = math.cos(a), math.sin(a) + face = E_W * ( + 0.05 * c * c * math.cos(2 * a) * np.cos(phi) + s * s / 0.1 * sigma / E_W + ) + edge = E_W * 0.05 * c * (1 + s * s) * np.sin(phi) + ref = section.max_bending_stress( + face * section.half_thickness_m, edge * section.half_width_m + ) + np.testing.assert_allclose(got, ref, rtol=1e-14, atol=0) + + +def test_laid_core_normal_gradient_follows_the_core_state(): + cable = cx.load_cable(cx.iea_task49_66kv_yaml_path()) + t = np.linspace(0.0, 2.0, 30) + kx, ky = 0.02 * np.sin(2 * np.pi * t + 0.1), 0.01 * np.cos(2 * np.pi * t) + eps = 1e-4 * np.ones_like(t) + for state in ("stuck", "free", "frictional"): + with warnings.catch_warnings(): + warnings.simplefilter("ignore") + kin = core_kinematics(cable, kx, ky, state=state, axial_strain=eps) + beta, r_c = kin.lay_angle_rad, kin.r_offset_m + c, s = math.cos(beta), math.sin(beta) + kr = ( + np.cos(kin.phase_rad)[:, None] * kx[None, :] + + np.sin(kin.phase_rad)[:, None] * ky[None, :] + ) + bending = kin.axis_strain - c * c * eps[None, :] + expected = c * c * math.cos(2 * beta) * kr + s * s / r_c * bending + scale = float(np.abs(kr).max()) + np.testing.assert_allclose( + kin.gradient_radial_per_m, expected, rtol=0, atol=1e-12 * scale + ) + if state == "stuck": + np.testing.assert_allclose( + kin.gradient_radial_per_m, c**4 * kr, rtol=0, atol=1e-12 * scale + ) + if state == "free": + np.testing.assert_allclose( + kin.gradient_radial_per_m, + c * c * math.cos(2 * beta) * kr, + rtol=0, + atol=1e-12 * scale, + ) + + +def test_strand_slip_outer_fibre_stick_slope_is_cos4(): + rings = [ + ConductorRing(n_wires=1, d_wire_m=0.003, r_helix_m=0.0, lay_angle_rad=0.0), + ConductorRing( + n_wires=6, d_wire_m=0.003, r_helix_m=0.003, lay_angle_rad=math.radians(12.0) + ), + ConductorRing( + n_wires=12, + d_wire_m=0.003, + r_helix_m=0.006, + lay_angle_rad=math.radians(14.0), + ), + ] + kwargs = {"mu_wire": 0.3, "reference_tension_N": 2e4} + outer = conductor_ring_parameters(rings, 110e9, fibre="outer", **kwargs) + centroid = conductor_ring_parameters(rings, 110e9, fibre="centroid", **kwargs) + assert outer[0].slip_state_factor == centroid[0].slip_state_factor == 1.0 + # Planar ramp to well above the onset, then the element at theta = 0. + kappa = np.linspace(0.0, 1.0, 2001) + for ring, o, m in zip(rings[1:], outer[1:], centroid[1:], strict=True): + c, s = math.cos(ring.lay_angle_rad), math.sin(ring.lay_angle_rad) + r, half = ring.r_helix_m, ring.d_wire_m / 2 + lox = half * c * c * math.cos(2 * ring.lay_angle_rad) + # The friction amplitude is the friction strain; the outer fibre + # carries the wire-axis strain with the factor of its slip state. + assert o.eps_f_ref == m.eps_f_ref + assert o.slip_state_factor == pytest.approx(1.0 + half * s * s / r, rel=1e-15) + assert m.slip_state_factor == 1.0 + assert m.beta_m == pytest.approx((r * c * c, 0.0), rel=1e-15) + strain = strand_slip_strain( + o, kappa, np.zeros_like(kappa), np.full_like(kappa, 2e4), theta_rad=[0.0] + ).strain[0] + onset = o.eps_f_ref[0] / (o.beta_m[0] - o.beta_m[1]) + stick = kappa < 0.9 * onset + slip = kappa > 1.1 * onset + assert stick.sum() > 10 and slip.sum() > 10 + axial = o.alpha_per_N * 2e4 + np.testing.assert_allclose( + strain[stick] - axial, (r * c * c + half * c**4) * kappa[stick], rtol=1e-12 + ) + np.testing.assert_allclose( + strain[slip] - axial, + lox * kappa[slip] + o.slip_state_factor * o.eps_f_ref[0], + rtol=1e-12, + ) diff --git a/tests/test_plotting_style.py b/tests/test_plotting_style.py index a1b00ce..85bfcc5 100644 --- a/tests/test_plotting_style.py +++ b/tests/test_plotting_style.py @@ -10,47 +10,70 @@ matplotlib.use("Agg") # headless backend for CI import matplotlib as mpl # noqa: E402 +import matplotlib.pyplot as plt # noqa: E402 from cablexsec.plotting import style # noqa: E402 -EXPECTED_PALETTE = { - "BLACK": "#000000", - "RED": "#CC0000", - "BLUE": "#0000CC", - "GREEN": "#006600", - "GREY": "#666666", - "ORANGE": "#CC6600", -} +#: MATLAB's default ``lines`` colour order (R2014b and later). +MATLAB_LINES = ( + "#0072BD", + "#D95319", + "#EDB120", + "#7E2F8E", + "#77AC30", + "#4DBEEE", + "#A2142F", +) # Test-taxonomy category. pytestmark = pytest.mark.analytical_sanity -def test_palette_exact() -> None: - assert style.COLORS == EXPECTED_PALETTE +def test_colour_order_is_matlab_lines() -> None: + assert style.MATLAB_ORDER == MATLAB_LINES + style.apply_style() + cycle = mpl.rcParams["axes.prop_cycle"].by_key()["color"] + assert tuple(c.upper() for c in cycle) == MATLAB_LINES + +def test_named_colours_are_matlab_hues() -> None: + hues = {k: v for k, v in style.COLORS.items() if k not in ("BLACK", "GREY")} + assert set(hues.values()) == set(MATLAB_LINES) + assert style.COLORS["BLUE"] == MATLAB_LINES[0] -def test_apply_style_sets_rcparams() -> None: + +def test_apply_style_sets_the_matlab_axes() -> None: style.apply_style() - assert mpl.rcParams["font.size"] == 11 - assert mpl.rcParams["savefig.dpi"] == 300 - assert mpl.rcParams["figure.dpi"] == 300 + assert mpl.rcParams["font.family"] == ["sans-serif"] + assert mpl.rcParams["font.sans-serif"][:2] == ["Helvetica", "Arial"] + assert mpl.rcParams["font.size"] == 10 + assert mpl.rcParams["axes.grid"] is False assert mpl.rcParams["xtick.direction"] == "in" assert mpl.rcParams["ytick.direction"] == "in" + assert mpl.rcParams["xtick.top"] is True + assert mpl.rcParams["ytick.right"] is True + assert mpl.rcParams["legend.fancybox"] is False + assert mpl.rcParams["savefig.dpi"] == 300 assert mpl.rcParams["text.usetex"] is False - assert "Times New Roman" in mpl.rcParams["font.serif"] + assert mpl.rcParams["mathtext.fontset"] == "custom" def test_use_style_restores_rcparams() -> None: mpl.rcParams["font.size"] = 7.0 with style.use_style(): - assert mpl.rcParams["font.size"] == 11 + assert mpl.rcParams["font.size"] == 10 assert mpl.rcParams["font.size"] == 7.0 -def test_prop_cycle_uses_palette() -> None: - style.apply_style() - cycle_colors = mpl.rcParams["axes.prop_cycle"].by_key()["color"] - assert cycle_colors[0] == "#000000" - assert set(EXPECTED_PALETTE.values()) == set(cycle_colors) +def test_standard_labels_render_with_symbols() -> None: + """Every standard label is valid mathtext and keeps numerals upright.""" + with style.use_style(): + fig, ax = plt.subplots() + for text in style.LABELS.values(): + ax.set_xlabel(text) + fig.canvas.draw() # raises on invalid mathtext + plt.close(fig) + assert r"\kappa" in style.LABELS["curvature"] + assert r"m$^{\mathrm{-1}}$" in style.LABELS["curvature"] + assert "1/m" not in "".join(style.LABELS.values()) diff --git a/tests/test_rect_tendon_paths.py b/tests/test_rect_tendon_paths.py index a5a774f..87af9bc 100644 --- a/tests/test_rect_tendon_paths.py +++ b/tests/test_rect_tendon_paths.py @@ -190,12 +190,18 @@ def test_strip_stress_at_faces_edges_and_corners(strip_layer): assert spec.section is not None and spec.section.shape == "rectangular" kx = np.array([0.0, 0.05, 0.1]) ky = np.zeros(3) - field = wire_stress_field(strip_layer, kx, ky) + field = wire_stress_field(strip_layer, kx, ky, keep_friction=True) + assert field.friction_Pa is not None c = curvature_coefficients(spec.lay_angle_rad) phi = spec.phi_wires[:, None] e = spec.E_wire_Pa + # Loxodrome normal term plus the slip-state term of the friction stress. + slip = math.sin(spec.lay_angle_rad) ** 2 / spec.r_helix_m * field.friction_Pa / e assert np.allclose( - field.radial_Pa, e * c.normal * kx * np.cos(phi) * 0.0025, rtol=1e-12, atol=1e-6 + field.radial_Pa, + e * (c.normal * kx * np.cos(phi) + slip) * 0.0025, + rtol=1e-12, + atol=1e-6, ) assert np.allclose( field.tangential_Pa, @@ -222,14 +228,27 @@ def test_transverse_model_in_the_field_reaches_the_geodesic(strip_layer): assert model.frictionless_fraction == pytest.approx(1.0, abs=1e-12) kx = np.linspace(0.0, 0.1, 21) field = wire_stress_field(strip_layer, kx, np.zeros_like(kx), transverse=model) - plain = wire_stress_field(strip_layer, kx, np.zeros_like(kx)) + plain = wire_stress_field(strip_layer, kx, np.zeros_like(kx), keep_friction=True) + assert plain.friction_Pa is not None + # The slip-state term of the friction stress is added to both fields. + held = ( + spec.E_wire_Pa + * math.sin(spec.lay_angle_rad) ** 2 + / spec.r_helix_m + * plain.friction_Pa + / spec.E_wire_Pa + * 0.0025 + ) assert np.allclose(field.tangential_Pa, 0.0, atol=1e-3) geo = curvature_coefficients(spec.lay_angle_rad, 1.0).normal lox = curvature_coefficients(spec.lay_angle_rad, 0.0).normal # the normal curvature gains the tangent-rotation term (finite difference # over the 55 wire azimuths) assert np.allclose( - field.radial_Pa, plain.radial_Pa * geo / lox, rtol=3e-3, atol=1e-3 + field.radial_Pa - held, + (plain.radial_Pa - held) * geo / lox, + rtol=3e-3, + atol=1e-3, ) assert np.array_equal(field.mean_Pa, plain.mean_Pa) diff --git a/tests/test_restrictor_tapes_copper.py b/tests/test_restrictor_tapes_copper.py index 8b61f52..5dedf05 100644 --- a/tests/test_restrictor_tapes_copper.py +++ b/tests/test_restrictor_tapes_copper.py @@ -577,7 +577,10 @@ def test_tape_states_closed_forms(): mu=0.2, ) assert np.allclose(lo, free) - centre = hi[0, :, 0, :] - own[:, None] * k[None, :] + # The stuck line carries factor rho cos(theta) kappa, which adds + # (t/2) (sin^2 beta / rho) times it to the flat-wise curvature. + held = g.thickness_m / 2 * math.sin(beta) ** 2 * factor * np.cos(theta) + centre = hi[0, :, 0, :] - (own + held)[:, None] * k[None, :] stuck_mid = factor * ( eps0[None, :] + g.radius_m * np.cos(theta)[:, None] * k[None, :] ) diff --git a/tests/test_rig_test.py b/tests/test_rig_test.py index 46cd8ff..181143f 100644 --- a/tests/test_rig_test.py +++ b/tests/test_rig_test.py @@ -144,6 +144,15 @@ def test_local_bending_and_axial_parts(menard, menard_run): / E * 1e6 ) + # The normal curvature follows the slip state: the friction strain the + # wire carries adds (d/2)(sin^2 a / r) times it at the outer face. + expected = expected + ( + layer.d_wire_m + / 2 + * math.sin(layer.lay_angle_rad) ** 2 + / layer.r_helix_m + * np.asarray(g.friction) + ) assert np.allclose(g.local_bending, expected, atol=1e-9) tension = 50e3 state = solve_cable_radial_state(menard, tension) diff --git a/tests/test_section_history.py b/tests/test_section_history.py index f6393f0..6a7d018 100644 --- a/tests/test_section_history.py +++ b/tests/test_section_history.py @@ -107,6 +107,8 @@ def test_variable_modulus_wire_history_matches_independent_plastic_strain_update friction = np.clip(stiffness[t] * (drive - plastic), -lower[t], upper[t]) plastic = drive - friction / stiffness[t] bending = modulus[t] * value * cosine**2 * math.cos(0.8) * 0.003 / 2 + # The normal curvature follows the slip state of the friction stress. + bending += 0.003 / 2 * sine**2 / spec.r_helix_m * friction expected.append(normal[t] + friction + bending) np.testing.assert_allclose(calculated[0], expected, rtol=1e-12, atol=1e-8) diff --git a/tests/test_stress.py b/tests/test_stress.py index 4384d4a..314d8c1 100644 --- a/tests/test_stress.py +++ b/tests/test_stress.py @@ -50,22 +50,31 @@ def _stress_contact(kappa=0.03): return cx.compute_stress(_contact_cable(), kappa, tension_N=0.0) -def test_sigma_B_at_phi0_matches_menard_eq14_closed_form() -> None: +def test_sigma_B_at_phi0_matches_menard_eq14_plus_the_slip_state_term() -> None: + # Ménard Eq. 14 is the normal curvature of a wire without friction + # stress; the friction stress the wire carries adds (sin^2 a / r) sigma_f / E + # (wire_stress.slip_state_normal_curvature). cable = _menard() - sr = _stress() - for name in sr.phi_deg: - lyr = cable.get_layer(name) - e = library.get_property(lyr.material, "E_Pa") - a = lyr.lay_angle_rad - closed = ( - e - * sr.kappa_mag_1_m - * math.cos(a) ** 2 - * math.cos(2 * a) - * (lyr.d_wire_m / 2.0) - ) - k0 = int(np.argmin(np.abs(sr.phi_deg[name]))) # wire nearest phi = 0 - assert sr.sigma_B_Pa[name][k0] == pytest.approx(closed, rel=1e-9) + for mu in (0.0, None): + with warnings.catch_warnings(): + warnings.simplefilter("ignore") + sr = cx.compute_stress(cable, 0.03, tension_N=1.0e4, mu=mu) + for name in sr.phi_deg: + lyr = cable.get_layer(name) + e = library.get_property(lyr.material, "E_Pa") + a = lyr.lay_angle_rad + k0 = int(np.argmin(np.abs(sr.phi_deg[name]))) # wire nearest phi = 0 + closed = ( + e + * ( + sr.kappa_mag_1_m * math.cos(a) ** 2 * math.cos(2 * a) + + math.sin(a) ** 2 / lyr.r_helix_m * sr.sigma_f_Pa[name][k0] / e + ) + * (lyr.d_wire_m / 2.0) + ) + assert sr.sigma_B_Pa[name][k0] == pytest.approx(closed, rel=1e-9) + if mu == 0.0: + assert sr.sigma_f_Pa[name][k0] == 0.0 def test_sigma_f_respects_per_wire_kappa_c_boundary() -> None: diff --git a/tests/test_validation_report.py b/tests/test_validation_report.py index 9f3e46d..785dad8 100644 --- a/tests/test_validation_report.py +++ b/tests/test_validation_report.py @@ -30,7 +30,9 @@ def incorrect_bending(*args, **kwargs): monkeypatch.setattr(run_validation.cx, "compute_stress", incorrect_bending) row = next(r for r in run_validation._rows() if r.ident == "σ_B") assert row.status == "FAIL" - assert float(row.value.rstrip("%")) == pytest.approx(100.0) + # Every state (mu = 0, stuck, slipping) reports the doubled bending. + values = [float(part.split()[-1].rstrip("%")) for part in row.value.split(";")] + assert values == pytest.approx([100.0, 100.0, 100.0]) @needs_numba diff --git a/tests/test_zeidan2025.py b/tests/test_zeidan2025.py index 4c527eb..aff9f69 100644 --- a/tests/test_zeidan2025.py +++ b/tests/test_zeidan2025.py @@ -117,20 +117,22 @@ def test_cable_geometry_follows_the_paper_table(): @full_scale def test_z_ei_reports_the_registered_outcome(): - """The measured stick secant lies below the packaged no-slip EI_max and - the measured slip slope above EI_min: Z-EI passes. Diagnosed on, not - independent: this row found the defect of the former shear stack, which - counted the EPR of the offset cores (xi 0.009 / 0.016, EI_max 12.0 kN m2, - FAIL). The stack now stops at the support: the bedding under the inner - armour (xi 0.832) and nothing between the armours (xi 1).""" + """The measured stick secant lies below the packaged no-slip EI_max; the + measured slip slope (plotted curvature) lies 4-17 % below EI_min with the + bonded outer face of the packaged input (gap G8): Z-EI fails narrowly. + With both faces sliding EI_min is 2.72 kN m2 and the slope is about 3.5 + times above it. The shear stack stops at the support: the bedding under + the inner armour (xi 0.832) and nothing between the armours (xi 1; the + bonded outer layer keeps it, its support being rigid).""" out = zd.z_ei() - assert out["pass"] is True + assert out["pass"] is False assert out["pass_plane_section"] is True assert list(out["xi"].values()) == pytest.approx([0.832, 1.0], abs=1e-3) assert out["ei_max_Nm2"] == pytest.approx(311.1e3, rel=1e-3) + assert out["ei_min_Nm2"] == pytest.approx(10.09e3, rel=1e-3) for amp in zd.AMPLITUDES_MM: assert max(out["stick_true_Nm2"][amp]) < out["ei_max_Nm2"] - assert out["slip_Nm2"][amp] > 3 * out["ei_min_Nm2"] + assert 0.83 < out["slip_Nm2"][amp] / out["ei_min_Nm2"] < 1.0 @full_scale diff --git a/validation/README.md b/validation/README.md index fc1fb52..a607994 100644 --- a/validation/README.md +++ b/validation/README.md @@ -12,7 +12,8 @@ global simulation files are not redistributed. | Path | Contents | | --- | --- | | [`validation_report.md`](validation_report.md) | The generated table of every analytical gate and benchmark, with targets, values and status | -| [`RELEASE_0_2_0.md`](RELEASE_0_2_0.md) | Environment, test results, gate results and distribution hashes for v0.2.0 | +| [`RELEASE_0_2_1.md`](RELEASE_0_2_1.md) | Environment, test results, gate results and distribution hashes for v0.2.1 | +| [`RELEASE_0_2_0.md`](RELEASE_0_2_0.md) | The same record for the 0.2.0 release | | [`RELEASE_0_1_0.md`](RELEASE_0_1_0.md) | The same record for the 0.1.0 release | | [`paper_data/`](paper_data/README.md) | Digitised published measurements and the results of the companion article's calculations | | `scripts/` | The report generator, benchmark harnesses and reproduction scripts listed below | diff --git a/validation/RELEASE_0_2_1.md b/validation/RELEASE_0_2_1.md new file mode 100644 index 0000000..8afc460 --- /dev/null +++ b/validation/RELEASE_0_2_1.md @@ -0,0 +1,65 @@ + + +# CableXSec v0.2.1 release record + +This record lists what was built and tested for the v0.2.1 release: the environments, the test +results and the release checks. Case definitions and pass criteria are in +[`VALIDATION.md`](../VALIDATION.md). The SHA-256 hashes of the published assets are those of +the `SHA256SUMS.txt` that the release workflow attaches to the GitHub release. + +## Source + +| Item | Value | +| --- | --- | +| CableXSec | `0.2.1` | +| Scope | the solver kernel (`cablexsec`) and its post-processing tools, the `cablexsec-batch` command, the tests, examples, validation data and scripts; no desktop application | +| Changes since 0.2.0 | a bonded outer armour face (gap G8), the relative core–core slip option of laid cores, the slip-state normal wire curvature (a correction that changes results), MATLAB-style figures; see [`CHANGELOG.md`](../CHANGELOG.md) | + +## Environments of the local gates + +Each environment is a new conda environment (conda-forge Python) into which the package and its +`dev`, `fast` and `contact` extras were installed with pip from the package index, as in CI. + +| Item | Python 3.11 | Python 3.12 | +| --- | --- | --- | +| Operating system | Windows 11 (x86-64), one thread per process (`OMP_NUM_THREADS`, `MKL_NUM_THREADS`, `OPENBLAS_NUM_THREADS`, `NUMBA_NUM_THREADS` = 1) | same | +| Python | 3.11.18 | 3.12.16 | +| Runtime | NumPy 2.4.6, SciPy 1.17.1, pandas 3.1.1, Pydantic 2.14.4, Matplotlib 3.11.2, PyYAML 6.0.4, rainflow 3.2.0 | NumPy 2.5.5, SciPy 1.18.1, pandas 3.1.1, Pydantic 2.14.4, Matplotlib 3.11.2, PyYAML 6.0.4, rainflow 3.2.0 | +| Optional | numba 0.68.1, Clarabel 0.11.1 | numba 0.68.1, Clarabel 0.11.1 | +| Tools | pytest 9.2.0, pytest-cov 7.1.0, pytest-xdist 3.8.0, Ruff 0.15.22, mypy 2.4.1, build 1.6.1, Twine 7.0.0, setuptools 84.2.1 | the same, and Sphinx 9.0.4, MyST-Parser 5.1.0, sphinx-rtd-theme 3.1.0 | + +## Test results + +| Gate | Result | +| --- | --- | +| Test suite, Python 3.12 (`python -m pytest -n 6`) | 5023 passed, 3 skipped (kernel-replacement tests that need the kernels as Python; they run in the `NUMBA_DISABLE_JIT=1` pass of the coverage gate) | +| Line and branch coverage of `cablexsec`, Python 3.11 (`release/check_coverage.py`: whole suite, then the kernel tests with `NUMBA_DISABLE_JIT=1`) | 96.60 %; gate 95 % | +| Ruff lint and format check (`src`, `tests`, `examples`, `validation`, `release`, `doc`) | clean on Python 3.11 and 3.12 | +| mypy, strict, package `cablexsec` (the CI configuration, Python 3.11 with NumPy 2.4.6) | no issues in 122 source files | +| Validation report (`validation/scripts/run_validation.py --check`, Python 3.11 and 3.12) | the committed report is current in both environments; 66 rows: 48 pass, 7 fail (BM1-loop, BM1-ID, Z-EI, HU-3PB, WITZ-ID, SV11-PLANE, SV11-GJ; registered targets unchanged), 8 stated without a target (info), 1 partial (BM5), 1 not comparable (HU-uniform), 1 not validated (BM4); taxonomy 1319 `analytical_sanity`, 92 `independent_method`, 59 `full_scale` tests | +| Sphinx documentation (`-W --keep-going`) | built with no warnings | +| Release metadata (`release/check_release_metadata.py`) | passed | +| Release-tree audit (`release/audit_release_tree.py --tree .` and `--archive-ref HEAD`) | passed | +| Python distributions (`python -m build`, `twine check`) | sdist and wheel pass; both carry LICENSE and NOTICE; the wheel holds only `cablexsec` and its metadata. With `SOURCE_DATE_EPOCH` set, the wheel is identical byte for byte between builds; the sdist holds identical files, but its PAX headers carry the build-time mtimes of the directories, so its hash differs between builds | +| Wheel in a new conda environment (Python 3.12), sdist in another (Python 3.11), each with the `fast` extra | in both: `cablexsec` imported from the environment, not the source tree; `release/smoke_test_wheel.py`; `cablexsec-batch --help`; the README quick start, with output identical to the README; all twelve examples, the four tutorial and the ten how-to scripts of the manual from a separate folder that holds their data but no source | + +Against 0.2.0, Z-ID now passes with the bonded outer armour face of the Zeidan (2025) input and +Z-EI fails narrowly (`EI_min` 10.09 kN·m² against a measured slip slope of 8.65–9.70 kN·m² in +the plotted curvature); the bonded state is an identified input, not a published one. The other +rows keep their 0.2.0 status. + +Under NumPy 2.5.5 (the Python 3.12 environment), mypy reports 40 errors in 14 files, all from +the NumPy 2.5 type stubs (argument-free `ndarray.min`/`max` and `ufunc.reduce` overloads), as +for 0.2.0; CI type-checks against the Python 3.11 wheels. + +The review of the release pull request found that a bonded layer at a zero lay angle (no +slider stiffness) was refused by the slip integrators; it is now elastic-only (commit +`fix: a bonded layer at a zero lay angle is elastic-only`). The test suite above is that of the +final tree. The coverage and validation-report gates ran before this fix and before the +quick-start correction of the README; the documentation and distribution gates ran after the +correction and before this fix. Neither change moves a validation row, and CI repeats every gate +on the release pull request. + +The CI matrix (`.github/workflows/python.yml`: Ubuntu, Windows and macOS with Python 3.11 and +3.12, a run without numba, coverage, the validation report, distributions and documentation) +runs on the release pull request. diff --git a/validation/scripts/coupled_core_slip_reference.py b/validation/scripts/coupled_core_slip_reference.py new file mode 100644 index 0000000..6cd08ea --- /dev/null +++ b/validation/scripts/coupled_core_slip_reference.py @@ -0,0 +1,313 @@ +# SPDX-License-Identifier: Apache-2.0 +# Copyright (c) 2026 Jae Hoon Seo, SMI Lab, Inha University +r"""Independent field solver of the coupled axial slip of laid cores. + +Reference for ``CoreFrictionSpec(core_core_coupling="relative")`` +(:mod:`cablexsec.mechanics.core_friction`). It imports only NumPy and SciPy and +shares no code with the package. + +Model (normalised, one pitch, periodic). ``n`` equal cores; ``x`` is the +azimuth of core 0 along the pitch and core ``i`` sits at the azimuth +``theta_i = x + 2 pi i / n``. Each core has its own field (no symmetry +reduction): the slip ``u_i(x)`` relative to the plane section and the axial +force ``n_i = a cos(theta_i - phi_b) + u_i'`` (``a`` the curvature in units in +which the axial rigidity and the helix geometry are one). Equilibrium +``n_i' = -f_i``, with the contact forces per unit ``x``: + +* intralayer contacts between neighbours ``(i, j)`` at the same ``x``: an + elastic--Coulomb spring on the relative slip ``u_i - u_j`` (penalty ``k_c``, + bound ``b_c``); the force on ``j`` is minus the force on ``i``; +* an interlayer contact of every core (filler, bedding, sheath): an + elastic--Coulomb spring on the absolute slip ``u_i`` (``k_a``, ``b_a``). + +Bounds are linear Coulomb bounds (no capstan term). The rigid contact is the +limit of a large penalty. + +Discretisation: ``N`` nodes per core and pitch, ``h = 2 pi / N``; nodes carry +``u`` and the contact springs, segments ``j`` (between nodes ``j`` and +``j + 1``, at ``x = (j + 1/2) h``) carry ``n``. Each load increment minimises +the incremental energy + + sum_i sum_j h n_ij^2 / 2 + sum_springs h Huber_{k, b}(r - p_old) + +over the nodal slips (``r`` the spring's relative or absolute slip, ``p_old`` +its slip at the start of the increment; the Huber envelope is the exact +backward-Euler potential of a spring--slider), by semismooth Newton with Armijo +backtracking and sparse direct solves. The pitch mean of every core's slip is +held at zero by Lagrange multipliers: this fixes the slides of whole cores that +change no force (a common slide without interlayer friction, and per-core +slides in full slip). On a planar path from a stress-free state the slip of +every core has zero pitch mean, so the constraint changes nothing else. + +Outputs per sample: the section moment of the cores (pitch mean of +``n cos(theta - phi_b)`` summed over the cores; the stuck moment is +``n a / 2``), the dissipated work, the fraction of springs in stick, and on +request the force fields. +""" + +from __future__ import annotations + +from dataclasses import dataclass, field + +import numpy as np +import scipy.sparse as sp +from numpy.typing import NDArray +from scipy.sparse.linalg import splu + +FloatArray = NDArray[np.float64] + +__all__ = ["CoupledSlipReference", "ReferencePath", "run_path"] + + +@dataclass(frozen=True) +class CoupledSlipReference: + """Cores, contacts and grid of the reference model. + + ``b_c`` is the bound of one intralayer contact (``n >= 3``: two contacts + per core; ``n = 2``: the single contact takes ``2 b_c``, so the per-core + capacity is ``b_a + 2 b_c`` in every case). ``a_cr = b_a + 2 b_c`` is the + uncoupled slip-onset curvature. + """ + + n_cores: int = 3 + nodes: int = 720 + b_c: float = 1.0 + b_a: float = 0.0 + k_c: float = 1.0e5 + k_a: float = 1.0e5 + + @property + def a_cr(self) -> float: + return self.b_a + 2.0 * self.b_c + + def contacts(self) -> list[tuple[int, int, float]]: + n = self.n_cores + if n == 2: + return [(0, 1, 2.0 * self.b_c)] if self.b_c > 0 else [] + if self.b_c <= 0: + return [] + return [(i, (i + 1) % n, self.b_c) for i in range(n)] + + +@dataclass +class ReferencePath: + """Results of :func:`run_path` (one entry per curvature sample).""" + + a: FloatArray + moment: FloatArray + dissipation: FloatArray + stick_fraction: FloatArray + newton_iterations: NDArray[np.int64] + forces: dict[int, FloatArray] = field(default_factory=dict) + contact_forces: dict[int, FloatArray] = field(default_factory=dict) + interlayer_forces: dict[int, FloatArray] = field(default_factory=dict) + segment_azimuth: FloatArray | None = None + + +def _huber(r: FloatArray, k: float, b: float) -> tuple[FloatArray, ...]: + """Value, slope and curvature of the Huber envelope at ``r``.""" + limit = b / k + inside = np.abs(r) <= limit + value = np.where(inside, 0.5 * k * r * r, b * np.abs(r) - 0.5 * b * limit) + slope = np.clip(k * r, -b, b) + # A spring on its bound at the start of an increment (|k r| = b after the + # last update) is taken as sticking; the Newton step then decides. + curvature = np.where(np.abs(k * r) <= b * (1.0 + 1e-12), k, 0.0) + return value, slope, curvature + + +class _Solver: + def __init__(self, ref: CoupledSlipReference, phi_b: float) -> None: + self.ref = ref + n, big_n = ref.n_cores, ref.nodes + self.n, self.N = n, big_n + self.h = 2.0 * np.pi / big_n + x_seg = (np.arange(big_n) + 0.5) * self.h + self.theta = x_seg[None, :] + 2.0 * np.pi * np.arange(n)[:, None] / n + self.shape = np.cos(self.theta - phi_b) # (n, N) + self.contacts = ref.contacts() + self.u = np.zeros((n, big_n)) + self.p_c = np.zeros((len(self.contacts), big_n)) + self.p_a = np.zeros((n, big_n)) + # Difference operator D u = (u_{j+1} - u_j) / h, periodic, per core. + eye = sp.identity(big_n, format="csr") + shift = sp.csr_matrix( + (np.ones(big_n), (np.arange(big_n), (np.arange(big_n) + 1) % big_n)), + shape=(big_n, big_n), + ) + d1 = (shift - eye) / self.h + self.D = sp.block_diag([d1] * n, format="csr") + self.K_axial = (self.h * (self.D.T @ self.D)).tocsr() + self.C = sp.block_diag( + [sp.csr_matrix(np.full((1, big_n), self.h))] * n, format="csr" + ) + + # Energy, gradient and generalised Hessian at the slip field ``u``. + def _parts(self, u: FloatArray, a: float, hess: bool): + ref, h = self.ref, self.h + force = a * self.shape + (self.D @ u.ravel()).reshape(u.shape) + energy = 0.5 * h * float(np.sum(force * force)) + grad = h * (self.D.T @ force.ravel()) + rows: list[FloatArray] = [] + cols: list[FloatArray] = [] + vals: list[FloatArray] = [] + nodes = np.arange(self.N) + for c, (i, j, b) in enumerate(self.contacts): + r = u[i] - u[j] - self.p_c[c] + value, slope, curv = _huber(r, ref.k_c, b) + energy += h * float(np.sum(value)) + grad_c = np.zeros_like(u) + grad_c[i] += h * slope + grad_c[j] -= h * slope + grad = grad + grad_c.ravel() + if hess: + wi, wj = i * self.N + nodes, j * self.N + nodes + for rr, cc, sgn in ( + (wi, wi, 1), + (wj, wj, 1), + (wi, wj, -1), + (wj, wi, -1), + ): + rows.append(rr) + cols.append(cc) + vals.append(sgn * h * curv) + if ref.b_a > 0.0: + r = u - self.p_a + value, slope, curv = _huber(r, ref.k_a, ref.b_a) + energy += h * float(np.sum(value)) + grad = grad + h * slope.ravel() + if hess: + idx = np.arange(self.n * self.N) + rows.append(idx) + cols.append(idx) + vals.append(h * curv.ravel()) + if not hess: + return energy, grad, None + size = self.n * self.N + extra = ( + sp.csr_matrix( + (np.concatenate(vals), (np.concatenate(rows), np.concatenate(cols))), + shape=(size, size), + ) + if vals + else sp.csr_matrix((size, size)) + ) + return energy, grad, (self.K_axial + extra).tocsc() + + def increment(self, a: float) -> int: + """Solve the increment to curvature ``a``; returns Newton iterations.""" + u = self.u.copy() + scale = max(abs(a), self.ref.a_cr, 1.0) * self.h + for iteration in range(1, 200): + energy, grad, hess = self._parts(u, a, True) + m = self.C.shape[0] + kkt = sp.bmat([[hess, self.C.T], [self.C, None]], format="csc") + rhs = np.concatenate([-grad, -(self.C @ u.ravel())]) + # Converged: projected gradient (gradient minus its multiplier part). + lam = np.linalg.lstsq(self.C.T.toarray(), -grad, rcond=None)[0] + residual = grad + self.C.T @ lam + if np.max(np.abs(residual)) <= 1e-10 * scale: + self.u = u + return iteration - 1 + try: + step = splu(kkt).solve(rhs)[: self.n * self.N] + except RuntimeError: # singular generalised Hessian: regularise + reg = kkt + sp.block_diag( + [sp.identity(self.n * self.N) * 1e-12, sp.csc_matrix((m, m))] + ) + step = splu(reg.tocsc()).solve(rhs)[: self.n * self.N] + slope0 = float(grad @ step) + t = 1.0 + while True: + trial = u + t * step.reshape(u.shape) + e_trial = self._parts(trial, a, False)[0] + if e_trial <= energy + 1e-4 * t * slope0 + 1e-15 * abs(energy): + break + t *= 0.5 + if t < 1e-12: + break + u = trial + raise RuntimeError("reference Newton did not converge") + + def commit( + self, a: float + ) -> tuple[float, float, FloatArray, FloatArray, FloatArray]: + """Update the slips; return work, stick fraction and the fields.""" + ref, h, u = self.ref, self.h, self.u + dissipation = 0.0 + stick = 0 + total = 0 + contact_f = np.zeros((len(self.contacts), self.N)) + for c, (i, j, b) in enumerate(self.contacts): + r = u[i] - u[j] - self.p_c[c] + slope = np.clip(ref.k_c * r, -b, b) + slipping = np.abs(ref.k_c * r) > b + new_p = np.where(slipping, u[i] - u[j] - slope / ref.k_c, self.p_c[c]) + dissipation += h * float( + np.sum(np.abs(slope) * np.abs(new_p - self.p_c[c])) + ) + self.p_c[c] = new_p + contact_f[c] = -slope # force on core i from core j + stick += int(np.count_nonzero(~slipping)) + total += self.N + inter_f = np.zeros((self.n, self.N)) + if ref.b_a > 0.0: + r = u - self.p_a + slope = np.clip(ref.k_a * r, -ref.b_a, ref.b_a) + slipping = np.abs(ref.k_a * r) > ref.b_a + new_p = np.where(slipping, u - slope / ref.k_a, self.p_a) + dissipation += h * float(np.sum(np.abs(slope) * np.abs(new_p - self.p_a))) + self.p_a = new_p + inter_f = -slope + stick += int(np.count_nonzero(~slipping)) + total += self.n * self.N + force = a * self.shape + (self.D @ u.ravel()).reshape(u.shape) + return dissipation, stick / max(total, 1), force, contact_f, inter_f + + +def run_path( + ref: CoupledSlipReference, + a_path: FloatArray, + *, + phi_b: float = 0.0, + keep: tuple[int, ...] = (), +) -> ReferencePath: + """Planar curvature path ``a_path`` (bending direction ``phi_b``).""" + a_path = np.asarray(a_path, dtype=np.float64) + solver = _Solver(ref, phi_b) + count = a_path.size + moment = np.zeros(count) + work = np.zeros(count) + stick = np.zeros(count) + iters = np.zeros(count, dtype=np.int64) + out = ReferencePath(a_path, moment, work, stick, iters) + out.segment_azimuth = solver.theta.copy() + total = 0.0 + previous = 0.0 + + def advance(a_from: float, a_to: float, depth: int) -> tuple[int, float, tuple]: + # Solve to ``a_to``; an increment that does not converge is split. + try: + used = solver.increment(a_to) + except RuntimeError: + if depth >= 12: + raise + mid = 0.5 * (a_from + a_to) + n1, d1, _ = advance(a_from, mid, depth + 1) + n2, d2, state = advance(mid, a_to, depth + 1) + return n1 + n2, d1 + d2, state + d, s, force, contact_f, inter_f = solver.commit(a_to) + return used, d, (s, force, contact_f, inter_f) + + for index, a in enumerate(a_path): + iters[index], d, (s, force, contact_f, inter_f) = advance(previous, float(a), 0) + previous = float(a) + total += d + work[index] = total + stick[index] = s + moment[index] = float(np.sum(force * solver.shape)) / ref.nodes + if index in keep: + out.forces[index] = force.copy() + out.contact_forces[index] = contact_f + out.interlayer_forces[index] = inter_f + return out diff --git a/validation/scripts/run_validation.py b/validation/scripts/run_validation.py index 8d31623..4357056 100644 --- a/validation/scripts/run_validation.py +++ b/validation/scripts/run_validation.py @@ -38,6 +38,7 @@ import cablexsec as cx from cablexsec.analysis.capacity import birdcage_buckling_detail from cablexsec.analysis.curve_comparison import cycle_work, insert_cycle_crossings +from cablexsec.cable_adapters import cable_to_mkappa_specs from cablexsec.cables import ( inter_array_single_core_legacy_r2_yaml_path, inter_array_three_core_legacy_r2_yaml_path, @@ -1554,24 +1555,47 @@ def _rows() -> list[Row]: ) ) - # σ_B closed form (Ménard Eq. 14) at φ=0. - sr = cx.compute_stress(menard, 0.03, tension_N=1.0e4) - name = next(iter(sr.phi_deg)) + # σ_B at φ=0: the normal curvature follows the wire's slip state, + # cos²a cos2a κ + (sin²a / r) σ_f / E. Without friction (μ = 0) it is + # Ménard Eq. 14; a stuck wire takes cos²a cos2a + ξ sin²a cos²a (cos⁴a + # at ξ = 1); a slipping wire adds the term of its friction stress. + name = next(iter(cx.compute_stress(menard, 0.03, tension_N=1.0e4).phi_deg)) lyr = menard.get_layer(name) e = library.get_property(lyr.material, "E_Pa") a = lyr.lay_angle_rad - closed = ( - e * sr.kappa_mag_1_m * math.cos(a) ** 2 * math.cos(2 * a) * (lyr.d_wire_m / 2) - ) - k0 = int(np.argmin(np.abs(sr.phi_deg[name]))) + c2, s2 = math.cos(a) ** 2, math.sin(a) ** 2 + lox = c2 * math.cos(2 * a) + xi_b = next( + s.xi + for s in cable_to_mkappa_specs(menard, 1.0e4) + if math.isclose(s.r_helix_m, lyr.r_helix_m) + ) + errors_b = [] + stuck_b = slipping_b = True + for kappa_b, mu_b in ((0.03, 0.0), (1.0e-5, None), (0.03, None)): + sr = cx.compute_stress(menard, kappa_b, tension_N=1.0e4, mu=mu_b) + k0 = int(np.argmin(np.abs(sr.phi_deg[name]))) + sigma_f0 = float(sr.sigma_f_Pa[name][k0]) + if mu_b == 0.0: + coefficient = lox * sr.kappa_mag_1_m + elif kappa_b < 1e-3: + stuck_b = not bool(sr.slipping[name][k0]) + coefficient = (lox + xi_b * s2 * c2) * sr.kappa_mag_1_m + else: + slipping_b = bool(sr.slipping[name][k0]) + coefficient = lox * sr.kappa_mag_1_m + s2 / lyr.r_helix_m * sigma_f0 / e + closed = e * coefficient * (lyr.d_wire_m / 2) + errors_b.append(_pct(sr.sigma_B_Pa[name][k0], closed)) rows.append( Row( "1", "σ_B", - "Radial-fibre bending vs Ménard Eq. 14 (φ=0 from extension side)", - "< 1e-6%", - f"{_pct(sr.sigma_B_Pa[name][k0], closed):.2e}%", - "PASS" if _pct(sr.sigma_B_Pa[name][k0], closed) < 1e-6 else "FAIL", + "Radial-fibre bending at φ=0 (from the extension side): μ = 0 vs " + "Ménard Eq. 14; stuck wire vs cos²α cos2α + ξ sin²α cos²α (cos⁴α at " + "ξ = 1); slipping wire vs Eq. 14 + (sin²α / r) σ_f / E", + "< 1e-6% each", + "μ = 0 {:.2e}%; stuck {:.2e}%; slipping {:.2e}%".format(*errors_b), + "PASS" if max(errors_b) < 1e-6 and stuck_b and slipping_b else "FAIL", ) ) diff --git a/validation/validation_report.md b/validation/validation_report.md index cd38394..5bec003 100644 --- a/validation/validation_report.md +++ b/validation/validation_report.md @@ -25,7 +25,7 @@ Every row is computed from published data or closed-form references in this repo | 1 | TQ-SV | Saint-Venant twist rigidity with free warping (trefoil filler lobes): 2 x 1 rectangle vs series solution; bonded annulus as a mirrored 60 deg sector vs polar moment | < 3e-4 relative; < 1e-6 relative | 1.0e-04; -1.5e-08 | PASS | | 1 | TQ-FT | Twist-rate wire stress of the fatigue path (Knapp 1981 Eqs. 2, 11): 66 kV armour stress and damage under tension and twist vs closed form; Feyrer 1x37 torque and tension from the wire stresses vs K_et, K_tt; mirror lay with reversed twist; zero twist vs none | < 1e-12; < 1e-12; < 1e-12; 0 | 4.5e-15; 2.2e-16; 0.0e+00; 0.0e+00 | PASS | | 1 | A11 | M-κ energy closure (loop area vs closed form) | < 0.1% | 0.082% | PASS | -| 1 | σ_B | Radial-fibre bending vs Ménard Eq. 14 (φ=0 from extension side) | < 1e-6% | 0.00e+00% | PASS | +| 1 | σ_B | Radial-fibre bending at φ=0 (from the extension side): μ = 0 vs Ménard Eq. 14; stuck wire vs cos²α cos2α + ξ sin²α cos²α (cos⁴α at ξ = 1); slipping wire vs Eq. 14 + (sin²α / r) σ_f / E | < 1e-6% each | μ = 0 0.00e+00%; stuck 0.00e+00%; slipping 0.00e+00% | PASS | | 1 | M-rec | Assembled per-wire moment vs compute_mkappa (cross-engine, single-core) | < 2% | 0.000% | PASS | | 1 | M-rec-3core | Cross-engine moment vs compute_mkappa with offset-core geometry and shared mean armour pressure | < 2% | 0.000% | PASS | | 1 | MK-Tcyc | compute_mkappa with a tension history cycling within the bending cycles vs the fatigue-path friction stress on the same history; work balance under the changing friction bound | < 1e-12 relative; < 1e-12 relative | 3.4e-16; 8.9e-16 | PASS | @@ -55,8 +55,8 @@ Every row is computed from published data or closed-form references in this repo | 2 | BM1 | Ménard full-slip EI_min (calibration-free) | < 15% | 0.6% (EI_min 3571 N·m²) | PASS | | 2 | BM1-loop | Ménard +/-0.10 M-kappa (range b), clamping identified on the measured +/-0.05 cycle work (range a), four-point test arrangement (Sec. 3: M = Fa L1, LVDT parabola) | ordered RMSE < 5%; matched experimental cycle work within 10% | P0 190.1 kPa; model -474/474 N·m and W=44.4 J/m vs measured 62.3 J/m; measured -502/526 N·m; ordered RMSE 5.45%; matched experimental work difference -28.8% | FAIL | | 2 | BM1-ID | Ménard laid cores, wedged trefoil and filler profiles (mu 0.2): P0 identified on range (b) cycle work, ranges (a), (c)-(f) predicted | (b) ordered RMSE < 5%; (a), (c)-(f) cycle work within 20% and ordered RMSE < 10% | P0 215.9 kPa; (a) +28.5% / 5.85%; (b) +0.0% / 2.75%; (c) +26.2% / 6.47%; (d) +15.2% / 4.96%; (e) -6.5% / 4.59%; (f) -11.7% / 4.43% | FAIL | -| 2 | Z-EI | Zeidan (2025) four-point test, 112 mm three-core cable: measured stick secant (x1.425, reading R2) vs the no-slip EI_max; measured slip slope vs EI_min (parameter-free) | stick secant <= EI_max and slip slope >= EI_min at 30-60 mm | stick 141-240 kN·m² vs EI_max 311.1 kN·m² (xi 0.832/1.000; plane-section 335 kN·m²); slip 8.65-9.70 vs EI_min 2.72 kN·m² | PASS | -| 2 | Z-ID | Zeidan (2025) loops at 30-60 mm in the four-point arrangement (reading R2), laid cores with wedge and filler profiles (mu 0.2): P0 identified on the 40 mm work, 30, 50, 60 mm predicted | 40 mm branch RMSE < 5%; 30, 50, 60 mm work within 20%, RMSE < 10%, moment range within 10% | P0 759.8 kPa; 30 mm +10.4% / 14.2% / -32.6%; 40 mm -0.0% / 13.7% / -39.5%; 50 mm -5.1% / 14.7% / -43.2%; 60 mm -9.6% / 15.4% / -45.5% | FAIL | +| 2 | Z-EI | Zeidan (2025) four-point test, 112 mm three-core cable: measured stick secant (x1.425, reading R2) vs the no-slip EI_max; measured slip slope vs EI_min (parameter-free) | stick secant <= EI_max and slip slope >= EI_min at 30-60 mm | stick 141-240 kN·m² vs EI_max 311.1 kN·m² (xi 0.832/1.000; plane-section 335 kN·m²); slip 8.65-9.70 vs EI_min 10.09 kN·m² | FAIL | +| 2 | Z-ID | Zeidan (2025) loops at 30-60 mm in the four-point arrangement (reading R2), laid cores with wedge and filler profiles (mu 0.2): P0 identified on the 40 mm work, 30, 50, 60 mm predicted | 40 mm branch RMSE < 5%; 30, 50, 60 mm work within 20%, RMSE < 10%, moment range within 10% | P0 1085.9 kPa; 30 mm +9.9% / 6.4% / -4.4%; 40 mm +0.0% / 4.5% / -8.0%; 50 mm -4.7% / 4.3% / -8.5%; 60 mm -9.0% / 4.4% / -8.0% | PASS (identified, then predicted) | | 2 | HU-3PB | Hu et al. (2022) conductor loop, third cycle, in its three-point arrangement (440 mm, ±6 mm; M = FL/4, kappa = 12w/L²) | loop area 3.185 N·m/m ±15% and transition share 34% ±10 points | KH: area 5.236 N·m/m (+64.4%), share 39.4%, M_max 8.83 N·m; Papailiou: area 4.354 N·m/m (+36.7%), share 32.8%, M_max 8.11 N·m | FAIL | | 2 | HU-uniform | Hu et al. (2022) conductor loop at uniform curvature (pre-T1 basis, kept for continuity) | loop area 3.185 N·m/m ±15% and transition share 34% ±10 points | KH: area 4.084 N·m/m (+28.2%), share 1.7%, M_max 7.58 N·m; Papailiou: area 3.340 N·m/m (+4.9%), share 1.7%, M_max 7.07 N·m | NOT COMPARABLE (the test does not impose uniform curvature) | | 2 | WITZ-EI | Witz (1996) pipe full-slip EI_min, 0 bar, vs measured gradients 1190 / 1014 N·m² (parameter-free) | within [913, 1309] N·m² (gradients ±10%) | 1007 N·m² (-15.4% / -0.7%) | PASS | @@ -79,8 +79,8 @@ Every row is computed from published data or closed-form references in this repo ## Test taxonomy (full gate suite) -- analytical_sanity: `1265 passed` -- independent_method: `79 passed` +- analytical_sanity: `1319 passed` +- independent_method: `92 passed` - full_scale: `59 passed` Run `pytest -m ` to reproduce each group.