From 9405665d9a5aa282053835f50789b4608f5bbd59 Mon Sep 17 00:00:00 2001 From: Jae Hoon Seo Date: Mon, 16 Nov 2026 19:46:19 +0900 Subject: [PATCH 1/2] feat: auto armour friction model for non-planar curvature and a default-change notice compute_fatigue (public and cablexsec.analysis.fatigue) and wire_stress_field take friction_model="auto": the direction-tied cap for a planar curvature path and the distributed helix model for any other. A path is planar when curvature_path_out_of_plane_ratio (largest distance of a sample from the principal line through the origin over the largest curvature) is at most PLANAR_PATH_TOLERANCE = 1e-3. Layers outside the distributed model (xi >= 1, a stick modulus that changes over the record, a rate-dependent friction law) keep the direction-tied cap; the provenance records the ratio, the model of every layer and any fallback. The default stays "direction_tied", bit for bit, and changes to "auto" in the next release. Until then a default call on a non-planar path warns once (DirectionTiedFrictionWarning, a FutureWarning) with the measured bias: under a steadily rotating curvature at twice the slip onset the largest per-wire friction-stress range of the direction-tied cap on the 66 kV inner armour was 0.94 (xi = 0.81, template) and 0.86 (xi = 0.99) of the distributed model's, bulk damage 0.79 and 0.55 at an S-N slope of 4 where friction governs; its friction work per revolution 0.38-0.69 of the planar cycle against 1.8-2.6. On planar and flat paths (minor/major axis up to about 0.3) its ranges are at or above the distributed ones. Cost of the distributed model on one thread: 1.0-1.5x the direction-tied time on the shipped fatigue examples, 13-16x on the 66 kV template. Also: - distributed_bound ("signed" default, unchanged; "uniform" without the capstan term) in compute_fatigue, wire_stress_field and the distributed wrappers; a bound on the total wire force is not offered because the clamping already holds the radial load of the tension share; - the distributed model of the fatigue path takes a constant stick modulus other than the layer's (one thermal block) as the Yun coefficient of that state; - the pitch-mean offset of the direction-tied cap in planar full slip, sigma_0 (sinh x0/x0 - 1), x0 = lam pi/2 (1.1 % of the peak on the 66 kV inner armour), is documented and kept: a zero-mean condition couples the wires, and removing it would move ranges by less than 1e-4; - anchored_heat_profile documents its constant bound against the signed bound of the sectional heat (cycle works within 0.25 % on a uniformly bent section); - the guide, concepts page and module notes no longer say the two laws give the same stress ranges under biaxial bending. No default-path result and no validation row changes. Signed-off-by: Jae Hoon Seo --- CHANGELOG.md | 76 +++ doc/api_python.rst | 1 + doc/concepts.md | 33 +- doc/glossary.rst | 3 +- doc/local_analysis_guide.md | 109 ++++- doc/tutorials/03_global_to_fatigue.md | 8 +- src/cablexsec/__init__.py | 2 + src/cablexsec/analysis/fatigue.py | 298 +++++++++++- src/cablexsec/analysis/frictional_heating.py | 18 + src/cablexsec/analysis/thermal_coupling.py | 19 +- src/cablexsec/api.py | 51 +- .../mechanics/distributed_friction.py | 52 +- src/cablexsec/mechanics/papailiou.py | 33 +- src/cablexsec/provenance.py | 21 + tests/test_biaxial_friction_default.py | 447 ++++++++++++++++++ validation/validation_report.md | 6 +- 16 files changed, 1097 insertions(+), 80 deletions(-) create mode 100644 tests/test_biaxial_friction_default.py diff --git a/CHANGELOG.md b/CHANGELOG.md index 4d563ce..a076e28 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -40,6 +40,42 @@ All notable changes to CableXSec are recorded in this file. The format follows level in one step where the measured force decays over 0.6–2.3 mm, so the work is 1–5 % low; the static peak rises 10.6 % from 0.01 to 0.2 Hz, which the law cannot represent, while the dynamic level does not move with frequency (no rate term supported at 0.13–2.5 mm/s). +- `friction_model="auto"` in `compute_fatigue` (public and `cablexsec.analysis.fatigue`) and + `wire_stress_field`: the direction-tied cap for a planar curvature path and the distributed + helix model for any other. A path is planar when its out-of-plane ratio + (`curvature_path_out_of_plane_ratio`, below) is at most `PLANAR_PATH_TOLERANCE = 1e-3`. A + layer that the distributed model does not cover (`ξ ≥ 1`, a stick modulus that changes over + the record, a rate-dependent friction law) keeps the direction-tied cap. The provenance + records the ratio, the model of every layer and the reason for a fallback. The default stays + `"direction_tied"` in this release, bit for bit (see Deprecated). +- `DirectionTiedFrictionWarning` (a `FutureWarning`): `compute_fatigue` warns once per call when + `friction_model` is left at its default and the curvature path is not planar. The + direction-tied cap turns with the bending direction. Under a steadily rotating curvature at + twice the slip onset its largest per-wire friction-stress range on the 66 kV inner armour was + 0.94 of the distributed model's with the template interface (`ξ = 0.81`) and 0.86 with a + near-rigid one (`ξ = 0.99`): bulk damage 0.79 and 0.55 of it at an S–N slope of 4 where the + friction range governs. Its friction work per revolution was 0.38–0.69 of the planar cycle, + against 1.8–2.6 in the distributed model. On planar and flat paths (minor over major axis up + to about 0.3) its ranges are at or above the distributed ones. The result is unchanged; an + explicit `friction_model` keeps the chosen law without the warning. Cost of the distributed + model on one thread: 1.0–1.5 times the direction-tied time on the shipped fatigue examples, + 13–16 times on the 66 kV template (substeps of 0.1 `κ_on`); with `"auto"` the largest damage + of the shipped examples changes by at most 0.02 %, on an hour of the 66 kV template at 10 Hz + it is 0.92 of the direction-tied value. Tests: tests/test_biaxial_friction_default.py. +- A bound option of the distributed friction model, `distributed_bound` in `compute_fatigue` + (public and `cablexsec.analysis.fatigue`) and `wire_stress_field`, `bound` in + `distributed_friction_history` and `distributed_wire_friction_stress`: `"signed"` (default, + `b = ρ g + λ n` with the capstan term on the signed bending force of the wire, unchanged bit + for bit) or `"uniform"` (`b = ρ g`, no capstan term, the same stress unit and onset). In + planar full slip the uniform bound gives the linear Coulomb field `σ0 λ x` and the signed one + `σ0 (C exp(λx) − 1)`, both spanning `σ0 λπ`, and the cycle work of the two forms differs by + less than 0.04 % on the 66 kV template armour (tested). A capstan term on the total wire force + (bending plus tension share) is not offered: the clamping `P1+P2` that scales `g` already + holds the radial load of the tension share, which it would count twice. +- `cablexsec.analysis.fatigue.curvature_path_out_of_plane_ratio`: the largest distance of a + curvature sample from the principal line through the origin over the largest curvature (zero + for a planar path in any plane, `b/a` for an ellipse, one for a circle), and + `PLANAR_PATH_TOLERANCE = 1e-3`, the planarity of `friction_model="auto"`. - An anchored armour wire can be held by an elastic anchor instead of a rigid one, in every route that anchors a wire: the termination correction (`TerminationSpec(k_anchor_N_m=K)`, clamp and along-wire solvers, with or without a curvature field), the along-wire chain @@ -132,6 +168,23 @@ All notable changes to CableXSec are recorded in this file. The format follows field breaks the Coulomb flow rule. The friction regime parameter of Zhu and Tan, not printed, follows from their Table 2. No solver change. +### Deprecated + +- Planned change: the default `friction_model` of `compute_fatigue` (public and + `cablexsec.analysis.fatigue`) changes from `"direction_tied"` to `"auto"` in the next release. + On a planar curvature path the two are the same, bit for bit; on a non-planar path the + default will solve the distributed helix model: higher friction-stress ranges than the + direction-tied cap under near-circular rotation, equal or lower ones on flat paths (see Added). + Until then the default is unchanged and warns (`DirectionTiedFrictionWarning`) on non-planar + paths; pass `friction_model` explicitly to keep the current behaviour. + +### Changed + +- The distributed friction model of the fatigue path accepts a constant stick modulus other than + the layer's (one block of a thermal history, which recomputes `ξ` from its moduli) as the Yun + coefficient `ξ = k/(E cos²α)` of that state. Before, any stick modulus other than the layer's + was refused; a stick modulus that changes over the record still is. + ### Fixed - Provenance of the default armour coefficient `mu_on_hdpe = 0.20` (and `mu_on_steel = 0.20` of @@ -142,6 +195,29 @@ All notable changes to CableXSec are recorded in this file. The format follows and the 20 MPa is an internal pressure; the contact pressure is 2–4 MPa (Dai, Sævik and Ye 2018, p. 428), where the measured dynamic coefficient of armour wire on in-service tape is 0.32, 0.20 and 0.18 at 1, 4 and 8 MPa. +- The documentation said that the direction-tied and distributed friction laws give the same + stress ranges under biaxial bending ("within 10 %", "fatigue is not affected"). That holds for + the template interface from about four times the slip onset; on a near-rigid interface the + direction-tied ranges on a circular orbit are 0.85–0.97 of the distributed ones from 1.5 to 8 + times the onset. The local analysis guide (Section 9, with the measured table), the concepts + page and the notes of `wire_slip_history` and `thermal_coupling` now give the measurements. +- The pitch mean of the direction-tied friction stress is documented: its bounds integrate the + capstan growth from the neutral axis (zero friction stress there), so in planar full slip the + stress `σ0 (exp(λx) − 1)` has the pitch mean `σ0 (sinh(x₀)/x₀ − 1)`, `x₀ = λπ/2`, about `λπ/12` + of the peak tensile friction stress (1.1 % on the 66 kV inner armour, 0.054 MPa), while the + periodic field of a uniformly bent pitch, as in the distributed model, has zero mean (tested). + The offset is kept: a zero-mean condition couples the wires, which the independent + spring–sliders of the law do not, and a uniform shift would move wire stresses out of their + own bounds. Removing it would leave the moment unchanged and change the largest per-wire + stress range by less than `1e-4` (planar, one-sided and rotating cycles); it raises the mean + stress of every wire by the offset. +- `anchored_heat_profile` documents that its anchoring ratio is solved with a constant friction + bound while the sectional heat it multiplies carries the signed capstan bound. On a uniformly + bent section the two bounds give cycle works within 0.25 % (66 kV template armour, 1.2 to 32 + times the slip onset); near an anchor, where the mean wire force reaches about `0.85 √a` bounds + per radian, a capstan term would move the local bound by up to `λ 0.85 √a`, which the + constant-bound solver does not resolve. A capstan bound breaks the translation invariance of + its exact chain projection, so the solver is unchanged. - The exported bending law no longer claims to follow `compute_mkappa` exactly. With the signed capstan bound the slip interval of a wire is asymmetric (the falling bound is the rising one times `exp(−λψ)`), which no Masing element carries; the Iwan law misses the section law's loops diff --git a/doc/api_python.rst b/doc/api_python.rst index 4993d17..eff9b0a 100644 --- a/doc/api_python.rst +++ b/doc/api_python.rst @@ -48,6 +48,7 @@ Fatigue .. autofunction:: cablexsec.compute_fatigue .. autofunction:: cablexsec.compute_long_term_fatigue .. autofunction:: cablexsec.compute_conductor_fatigue +.. autofunction:: cablexsec.analysis.fatigue.curvature_path_out_of_plane_ratio Thermal ------- diff --git a/doc/concepts.md b/doc/concepts.md index da6dbde..5f199d4 100644 --- a/doc/concepts.md +++ b/doc/concepts.md @@ -112,18 +112,27 @@ history of the two curvature components. Three friction laws are available: bending direction. - `"progressive"`: each wire is split into parallel spring–sliders, so it leaves stick gradually. -- `"distributed"`, used by the fatigue functions: the friction force is solved - along one pitch, which removes the dependence on a bending direction. - -Section 9 of the local analysis guide helps choose between them. - -The laws give the same stress ranges but not the same friction work when the -bending direction rotates. The direction-tied cap turns with the bending -direction, so on a circular orbit a wire slips mostly near the neutral axis, -where its cap is small. Its work per revolution is then 0.16 of the -distributed law's at twice the slip onset and 0.57 at large amplitude, while -the wire stress ranges agree within 10 %. The frictional heat of -`compute_thermal_fatigue` is therefore always the dissipation of the +- `"distributed"`: the friction force is solved along one pitch, which + removes the dependence on a bending direction. + +The fatigue functions also take `"auto"`: the direction-tied law for a planar +curvature path, the distributed law for any other. Their default is +`"direction_tied"` in this release and changes to `"auto"` in the next one; +until then the default warns (`DirectionTiedFrictionWarning`, a +`FutureWarning`) when the path is not planar, the only case in which the two +differ. Section 9 of the local analysis guide helps choose +between them. + +The laws differ when the bending direction rotates. The direction-tied cap +turns with the bending direction, so on a circular orbit a wire slips mostly +near the neutral axis, where its cap is small. Its work per revolution is then +0.16 of the distributed law's at twice the slip onset and 0.57 at large +amplitude, and its largest wire stress range is 0.94 of the distributed one +at twice the slip onset on the 66 kV template interface and 0.86 on a +near-rigid interface (bulk damage about 0.55 to 0.8 times at an S–N slope of +4). On planar paths its stress ranges are at or above the distributed ones. +For a non-planar record use `friction_model="auto"` or `"distributed"`; the +frictional heat of `compute_thermal_fatigue` is always the dissipation of the distributed law. ## Two bounds bracket the bending stiffness diff --git a/doc/glossary.rst b/doc/glossary.rst index 282d9d0..c340483 100644 --- a/doc/glossary.rst +++ b/doc/glossary.rst @@ -1325,7 +1325,8 @@ Terms and abbreviations Warnings issued when a run succeeds but rests on an assumption or leaves its validated range: :term:`ExtrapolationWarning`, :term:`MissingClampingStateWarning`, ``UnmodelledPolymerSofteningWarning``, ``UnevaluatedFatigueCurveWarning``, - ``UnvalidatedModelWarning`` and ``TransverseMapWarning``. + ``UnvalidatedModelWarning`` and ``TransverseMapWarning``; and the ``FutureWarning`` + ``DirectionTiedFrictionWarning`` of a default that changes in the next release. wear Loss of material from a contact by sliding. :func:`~cablexsec.compute_fretting` computes the diff --git a/doc/local_analysis_guide.md b/doc/local_analysis_guide.md index 7f60041..d6eb22d 100644 --- a/doc/local_analysis_guide.md +++ b/doc/local_analysis_guide.md @@ -1477,11 +1477,38 @@ run uncompiled. the ξ-reduced stick stiffness and the Papailiou bounds of the current bending direction (held below `0.1 m κ_on`, `direction_hold_fraction`, `m = 1 − 3λ²/8`, `λ = μ |sin α|`). + + **Planned change of the default.** The default of `compute_fatigue` becomes + `"auto"` (below) in the next release. The two are the same, bit for bit, on + a planar curvature path, so only non-planar paths change. Until then, left + at the default on a non-planar path (out-of-plane ratio above + `PLANAR_PATH_TOLERANCE`), `compute_fatigue` warns once per call + (`DirectionTiedFrictionWarning`, a `FutureWarning`, with the measured bias + below); the result of this release is unchanged. Pass `friction_model` + explicitly to keep the current behaviour (`"direction_tied"`) or to take the + coming one (`"auto"`) without the warning. The sea-state batch passes its + option explicitly and does not warn. +- `"auto"` (opt-in): the direction-tied law for a planar curvature path and + the distributed law for any other. The path is planar when its out-of-plane ratio + (`curvature_path_out_of_plane_ratio`: the largest distance of a sample + `(κ_x, κ_y)` from the principal line through the origin, over the largest + curvature) is at most `PLANAR_PATH_TOLERANCE = 1e-3`. A planar path in any + plane gives round-off, the same path written with six significant digits + less than `1e-5`, an ellipse its axis ratio. A layer the distributed law + does not cover (rigid interface `ξ ≥ 1`, a stick modulus that changes over + the record, a rate-dependent friction law) keeps the direction-tied law. The + provenance records the ratio, the model of every layer and the reason for a + fallback. `wire_stress_field` takes `"auto"` too. - `"distributed"`: the friction force is solved along one pitch of the helix with interface shear stiffness `k̂ = ξ/(1 − ξ)` and the capstan bound `λ n` on the signed wire force, for any biaxial curvature history and the same clamping history. Stick zones then anchor the force distribution, so - the result does not depend on a bending direction. + the result does not depend on a bending direction. `distributed_bound= + "uniform"` drops the capstan term (`b = ρ g`, the linear Coulomb bound of the + clamping, for sensitivity studies); the default `"signed"` is the bound + above. A capstan term on the total wire force (bending plus tension share) + is not offered: the clamping `P1+P2` that scales `g` already contains the + radial load of the tension share. In every law the capstan term acts on the wire's own force (Papailiou 1997, Eq. 14 with the signed helix angle): a rising wire stress is bounded by @@ -1530,7 +1557,9 @@ most 0.03% between four and eight; at the reference arc, substeps of 0.03 `κ_on` instead of 0.1 changed it by less than 1e-6 (relative). Check both settings for a new history. The model requires a constant stick modulus (a section-state history that changes ξ or the wire -modulus is rejected) and `0 < ξ < 1`. +modulus is rejected; a constant one other than the layer's, as in one block +of a thermal history, enters as the Yun coefficient `ξ = k/(E cos²α)` of that +state) and `0 < ξ < 1`. The two laws coincide below slip onset and in planar full slip. In planar partial slip the distributed law gives smaller stress ranges because the @@ -1540,14 +1569,19 @@ law at `κ/κ_on` = 1.2, 1.5, 3, 10 and 30. On the companion article's reference distributed total armour damage is 0.44–1.15 of the default law, depending on the section; at the 263.478 m arc it is 0.62 (U = 10.74 m/s). These are model-to-model differences, not a validation; no measured armour strain under -biaxial bending is available. Cost is about twice the default stress and -damage time (1.46 s against 0.70 s per section-hour on one thread at four -nodes per wire). - -**Friction work under rotating curvature.** The stress ranges of the two laws -stay close under biaxial bending, but their friction work does not. The -direction-tied cap is the friction stress accumulated from the current -neutral axis, so it turns with the bending direction. On a circular orbit a +biaxial bending is available. Cost grows with the curvature increment per +sample in units of `κ_on` (the substeps are at most 0.1 `κ_on`). On one +thread, the distributed law took 1.0 to 1.5 times the direction-tied stress +and damage time on the shipped fatigue examples (inter-array single-core +cable, `examples/demo_05_fatigue_damage.py`, the long-term examples and the +release profile) and 13 to 16 times on the 66 kV template (an hour sampled at +10 Hz at 0.004 1/m: 43.6 s against 3.2 s; the 2000 s record of +[template_66kv.md](template_66kv.md): 36 s against 2.2 s). Planar records keep +the direction-tied cost under `"auto"`. + +**Rotating curvature.** The direction-tied cap is the friction stress +accumulated from the current neutral axis, so it turns with the bending +direction. On a circular orbit a wire passes the extreme fibre, where its cap is largest, while its drive is stationary, and it slips mostly near the neutral axis, where its cap is close to zero. In the distributed law every helix node slips at its own traction @@ -1568,8 +1602,59 @@ up to `O(λ²)`; `tests/test_orbit_friction_heat.py` checks both limits. On the A planar cycle of the same amplitudes dissipates the same work in both laws within 3 % (at large amplitude the direction-tied work is `sinh(x₀)/x₀` times the distributed one, 1.0005–1.0008 here), and a figure-eight orbit -(`κ_y` at twice the frequency of `κ_x`) 0.66–0.78 of the distributed work. Fatigue is not affected, but a heat source -is: `compute_thermal_fatigue` takes the frictional heat of its `Pi2` +(`κ_y` at twice the frequency of `κ_x`) 0.66–0.78 of the distributed work. + +The stress ranges also fall short on near-circular paths, and more so on a +stiffer interface, because the distributed law's stick zones then hold more +of the force. Largest per-wire friction-stress range of the inner armour of +the 66 kV template (100 kN), direction-tied over distributed, in the last of +four revolutions of an ellipse centred on the straight cable (the circle row +of the template interface is the table above; a stiffer interface widens the +gap): + +| Minor / major axis | ξ | 1.5 `κ_on` | 2 `κ_on` | 4 `κ_on` | 8 `κ_on` | +| --- | --- | --- | --- | --- | --- | +| 1 (circle) | 0.81 (template) | 0.937 | 0.943 | 0.981 | 1.001 | +| 1 (circle) | 0.99 | 0.854 | 0.863 | 0.933 | 0.970 | +| 0.8 | 0.81 | 1.021 | 1.056 | 1.057 | 1.039 | +| 0.8 | 0.99 | 0.933 | 0.976 | 1.011 | 1.009 | +| 0.5 | 0.81 | 1.093 | 1.080 | 1.050 | 1.031 | +| 0.5 | 0.99 | 0.984 | 1.023 | 1.011 | 1.007 | +| 0.3 | 0.81 | 1.121 | 1.068 | 1.041 | 1.025 | +| 0.3 | 0.99 | 1.009 | 1.016 | 1.010 | 1.006 | +| 0 (planar) | 0.81 | 1.117 | 1.080 | 1.023 | 1.010 | +| 0 (planar) | 0.99 | 1.019 | 1.008 | 1.001 | 1.001 | + +At an S–N slope of 4 the circle at twice the onset gives 0.79 (ξ = 0.81) and +0.55 (ξ = 0.99) of the distributed bulk damage where friction governs the +range. The friction work of one revolution is 0.38 to 0.69 of the planar cycle +of the same amplitude in the direction-tied law and 1.8 to 2.6 in the +distributed law (ξ = 0.99, two to eight times the onset). Flat paths +(minor over major axis up to about 0.3, and planar ones) give direction-tied +ranges at or above the distributed ones, so the switch of `"auto"` at the +planarity tolerance moves a result from the direction-tied value towards the +lower distributed one (at most the planar rows above). On the shipped +examples `"auto"` changes the largest damage by at most 0.02 %; on the 66 kV +hour above it gives 0.92 of the direction-tied value, and on the +[template_66kv.md](template_66kv.md) record 0.99 +(`tests/test_biaxial_friction_default.py`). + +**Pitch mean of the direction-tied law.** Its bounds integrate the capstan +growth from the neutral axis, where the friction stress is zero (Papailiou +1997, Eq. 14). In planar full slip the wire at the azimuth `x` from the +neutral axis toward tension carries `σ0 (exp(λx) − 1)`, whose pitch mean is +`σ0 (sinh(x₀)/x₀ − 1)`, `x₀ = λπ/2`: `λπ/12` of the peak tensile friction +stress to leading order (1.1 % on the 66 kV inner armour, 0.054 MPa; 0.9 % on +its outer armour). A periodic friction field of a uniformly bent pitch has zero +mean, as in the distributed law (`σ0 (C exp(λx) − 1)`). The offset is kept, +because a zero-mean condition couples the wires of a layer, which the +independent spring–sliders of this law do not. Removing it by a uniform shift +would leave the moment unchanged (round-off), change the largest per-wire +stress range by less than `1e-4` (planar, one-sided and rotating cycles from +two to 32 times the onset) and lower the mean stress of every wire by the +offset. + +The frictional heat is affected the most: `compute_thermal_fatigue` takes the frictional heat of its `Pi2` diagnostic from the distributed law whatever `friction_model` the fatigue uses (64 nodes per pitch and substeps of `κ_on`, within 0.25 % of the fatigue-path settings at about a hundredth of their cost; diff --git a/doc/tutorials/03_global_to_fatigue.md b/doc/tutorials/03_global_to_fatigue.md index fc66c29..d834649 100644 --- a/doc/tutorials/03_global_to_fatigue.md +++ b/doc/tutorials/03_global_to_fatigue.md @@ -187,7 +187,7 @@ gives `T_e − p_o A_o`, and use `fatigue_from_series`. ```text -warnings: MissingClampingStateWarning +warnings: DirectionTiedFrictionWarning, MissingClampingStateWarning inner_armour: 139 wires, damage 7.749e-09 to 1.388e-08, largest on wire 70 at 181.3 deg, fibre 180.00 deg outer_armour: 145 wires, damage 7.462e-09 to 8.927e-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) @@ -214,6 +214,12 @@ publishes none, and the run says so with `MissingClampingStateWarning`. The armour friction then comes from the tension alone, so the friction stresses and damages sit at their low end (Section 4.4 of the local analysis guide). +`DirectionTiedFrictionWarning` announces a change of default: the record +bends the cable in more than one plane, and the next release will solve such +records with `friction_model="auto"`, the distributed helix friction model, +instead of the direction-tied law used here (Section 9 of the local analysis +guide). Pass `friction_model` explicitly to choose the law and silence it. + ```{figure} figures/tutorial_03_damage_circumference.png :alt: Miner damage of every inner and outer armour wire against its azimuth. :width: 100% diff --git a/src/cablexsec/__init__.py b/src/cablexsec/__init__.py index 725359e..1da60de 100644 --- a/src/cablexsec/__init__.py +++ b/src/cablexsec/__init__.py @@ -307,6 +307,7 @@ from cablexsec.mechanics.tendon_section import WireSection from cablexsec.mechanics.thermal_network import ThermalNetwork, thermal_network from cablexsec.provenance import ( + DirectionTiedFrictionWarning, MissingClampingStateWarning, UnmodelledPolymerSofteningWarning, ) @@ -570,6 +571,7 @@ "Provenance", "ValidatedRange", "ExtrapolationWarning", + "DirectionTiedFrictionWarning", "UnevaluatedFatigueCurveWarning", "UnvalidatedModelWarning", "MissingClampingStateWarning", diff --git a/src/cablexsec/analysis/fatigue.py b/src/cablexsec/analysis/fatigue.py index 3e45d9d..8234d2d 100644 --- a/src/cablexsec/analysis/fatigue.py +++ b/src/cablexsec/analysis/fatigue.py @@ -58,6 +58,7 @@ import dataclasses import math +import warnings from collections.abc import Iterator, Mapping from dataclasses import dataclass, field from typing import Literal @@ -90,6 +91,7 @@ from cablexsec.materials.mean_stress import MeanStressSpec from cablexsec.materials.sn_curves import SNcurve, SWTLifeConstants from cablexsec.mechanics.distributed_friction import ( + BOUND_FORMS, DEFAULT_MAX_INCREMENT, DEFAULT_NODES_PER_WIRE, FRICTION_MODELS, @@ -118,7 +120,11 @@ from cablexsec.mechanics.tendon_bending import LateralRelief, TransverseSlipModel from cablexsec.mechanics.tendon_section import WireSection from cablexsec.mechanics.wire_stress import local_bending_fibre_stress -from cablexsec.provenance import Provenance, real_array +from cablexsec.provenance import ( + DirectionTiedFrictionWarning, + Provenance, + real_array, +) # The compiled kernels are selected only when numba is active (module # attributes, so that tests can force the reference paths). @@ -126,16 +132,34 @@ _FAST_RAINFLOW = HAVE_NUMBA RainflowCounter = Literal["auto", "compiled", "reference"] -FrictionModel = Literal["direction_tied", "distributed", "progressive"] +FrictionModel = Literal["auto", "direction_tied", "distributed", "progressive"] +DistributedBound = Literal["signed", "uniform"] +#: Out-of-plane ratio (:func:`curvature_path_out_of_plane_ratio`) at or below +#: which ``friction_model="auto"`` treats a curvature path as planar (and above +#: which the default direction-tied law warns). +PLANAR_PATH_TOLERANCE = 1e-3 +#: Measured bias of the direction-tied law under rotating curvature, quoted by +#: :class:`~cablexsec.provenance.DirectionTiedFrictionWarning`. +DIRECTION_TIED_ROTATION_BIAS = ( + "under a steadily rotating curvature at twice the slip onset its largest " + "per-wire friction-stress range was 0.94 (template interface, xi = 0.81) " + "and 0.86 (near-rigid interface, xi = 0.99) of the distributed helix " + "model on the 66 kV template inner armour, i.e. bulk damage about 0.79 " + "and 0.55 of it at an S-N slope of 4 where the friction range governs; " + "on planar and flat paths (minor over major axis up to about 0.3) its " + "ranges are at or above the distributed ones" +) CopperContactModel = Literal["slip_cycle", "legacy_gross_sliding"] COPPER_CONTACT_MODELS: tuple[str, ...] = ("slip_cycle", "legacy_gross_sliding") __all__ = [ + "PLANAR_PATH_TOLERANCE", "FatigueLayer", "FatigueResult", "WireStressField", "wire_stress_field", "compute_fatigue", + "curvature_path_out_of_plane_ratio", "miner_damage", "rainflow_cycles", ] @@ -143,6 +167,108 @@ FloatArray = NDArray[np.float64] +def curvature_path_out_of_plane_ratio( + kappa_x: FloatArray, kappa_y: FloatArray +) -> float: + """Out-of-plane extent of a curvature path, relative to its largest curvature. + + A planar history keeps one bending plane: every sample ``(kappa_x, + kappa_y)`` lies on one line through the origin. The line is the principal + axis of the second moment ``sum k k^T`` of the samples about the origin + (not about their mean: the bending plane passes through the straight + cable). The ratio is the largest distance of a sample from that line over + the largest curvature magnitude: zero for a planar path in any plane, one + for a circle, ``b/a`` for an ellipse of semi-axes ``a >= b`` centred on + the origin. A zero history returns zero. + """ + kx = np.asarray(kappa_x, dtype=np.float64) + ky = np.asarray(kappa_y, dtype=np.float64) + if kx.shape != ky.shape: + raise CableInputError("kappa_x and kappa_y must have the same shape") + peak = float(np.max(np.hypot(kx, ky))) if kx.size else 0.0 + if peak == 0.0 or not math.isfinite(peak): + return 0.0 + # Scale first: the second moment of tiny or huge curvatures stays finite. + x, y = kx / peak, ky / peak + sxx, syy, sxy = float(x @ x), float(y @ y), float(x @ y) + angle = 0.5 * math.atan2(2.0 * sxy, sxx - syy) + distance = np.abs(y * math.cos(angle) - x * math.sin(angle)) + return float(np.max(distance)) + + +def _distributed_spec( + spec: HelicalLayerSpec, + stick_modulus_Pa: FloatArray | None, + friction_law: FrictionLaw | None, +) -> tuple[HelicalLayerSpec | None, str]: + """Layer for the distributed model, or ``None`` and why the model does not apply. + + A constant stick modulus is the Yun coefficient ``xi = k / (E cos^2 a)`` + of that state (a thermal block recomputes ``xi`` from its moduli), so the + layer is returned with that coefficient. A stick modulus that changes + over the record, a rigid interface (``xi >= 1``) and a rate-dependent + friction law are not covered by the distributed model. + """ + law = active_friction_law(friction_law) + if law is not None and law.rate_dependent: + return None, "the friction law is rate dependent" + if stick_modulus_Pa is not None: + stick = np.asarray(stick_modulus_Pa, dtype=np.float64) + if stick.size and not np.allclose(stick, stick[0], rtol=1e-12, atol=0.0): + return None, "the stick modulus changes over the record" + if stick.size and not np.allclose(stick, spec.k_f, rtol=1e-12, atol=0.0): + spec = dataclasses.replace( + spec, + xi=float(stick[0]) + / (spec.E_wire_Pa * math.cos(spec.lay_angle_rad) ** 2), + ) + if not (math.isfinite(spec.xi) and 0.0 <= spec.xi < 1.0): + return None, f"the interface is rigid (xi = {spec.xi:.6g})" + return spec, "" + + +def _resolve_friction_model( + friction_model: str, + spec: HelicalLayerSpec, + out_of_plane: float, + stick_modulus_Pa: FloatArray | None, + friction_law: FrictionLaw | None, +) -> tuple[str, str]: + """Friction model of one layer and, for ``"auto"``, why it fell back.""" + _check_friction_model(friction_model) + if friction_model != "auto": + return friction_model, "" + if out_of_plane <= PLANAR_PATH_TOLERANCE: + return "direction_tied", "" + usable, reason = _distributed_spec(spec, stick_modulus_Pa, friction_law) + if usable is None: + return "direction_tied", reason + return "distributed", "" + + +def _warn_default_direction_tied(out_of_plane: float, stacklevel: int) -> None: + """Warn that the default direction-tied law runs on a non-planar path.""" + if out_of_plane <= PLANAR_PATH_TOLERANCE: + return + warnings.warn( + "the default friction_model will change from 'direction_tied' to 'auto' " + "in the next release; pass friction_model explicitly to keep the current " + "behaviour. This curvature path is not planar (out-of-plane ratio " + f"{out_of_plane:.3g} > {PLANAR_PATH_TOLERANCE:g}), so 'auto' would " + "solve the distributed helix model here. The direction-tied cap turns " + f"with the bending direction: {DIRECTION_TIED_ROTATION_BIAS}.", + DirectionTiedFrictionWarning, + stacklevel=stacklevel + 1, + ) + + +def _check_distributed_bound(bound: str) -> None: + if bound not in BOUND_FORMS: + raise CableInputError( + f"distributed_bound must be one of {BOUND_FORMS}, got {bound!r}" + ) + + def _validate_tension( tension_N: FloatArray | None, EA_full_N: float | None, @@ -521,6 +647,7 @@ def _wire_stress_series( friction_out: list[FloatArray] | None = None, friction_law: FrictionLaw | None = None, time_s: FloatArray | None = None, + distributed_bound: DistributedBound = "signed", ) -> FloatArray: """Build ``sigma_total(phi_k, t)`` for every wire of one layer [Pa]. @@ -590,7 +717,15 @@ def _wire_stress_series( a, ) - _check_friction_model(friction_model) + friction_model, _reason = _resolve_friction_model( # type: ignore[assignment] + friction_model, + spec, + curvature_path_out_of_plane_ratio(kappa_x, kappa_y) + if friction_model == "auto" + else 0.0, + stick_modulus_Pa, + friction_law, + ) if progressive is not None and friction_model != "progressive": raise CableInputError( "progressive settings require friction_model='progressive'" @@ -624,16 +759,19 @@ def _wire_stress_series( ).stress_Pa elif friction_model == "distributed": # Distributed elastic-Coulomb helix model (see distributed_friction). + # A constant stick modulus enters as the Yun coefficient of its state. + usable, _reason = _distributed_spec(spec, stick_modulus_Pa, None) sigma_f_kt = distributed_wire_friction_stress( - spec, + spec if usable is None else usable, kappa_x, kappa_y, contact_pressure_Pa=contact_pressure_Pa, - stick_modulus_Pa=stick_modulus_Pa, + stick_modulus_Pa=stick_modulus_Pa if usable is None else None, nodes_per_pitch=distributed_nodes_per_pitch, max_increment=distributed_max_increment, friction_law=law, time_s=time_s, + bound=distributed_bound, ) elif stick_modulus_Pa is None and _FAST_SLIP: # Compiled force recursion, identical to wire_slip_history().stress_Pa @@ -817,6 +955,7 @@ def wire_stress_field( keep_friction: bool = False, friction_law: FrictionLaw | None = None, time_s: FloatArray | None = None, + distributed_bound: DistributedBound = "signed", ) -> WireStressField: """Recover the shared stress field once, retaining all preceding slip history. @@ -828,10 +967,14 @@ def wire_stress_field( (default, :func:`~cablexsec.mechanics.fast_slip.wire_friction_stress`) or ``"distributed"`` (:func:`~cablexsec.mechanics.distributed_friction.distributed_friction_history` - with ``distributed_nodes_per_pitch`` and ``distributed_max_increment``). + with ``distributed_nodes_per_pitch``, ``distributed_max_increment`` and + the bound form ``distributed_bound``). ``"progressive"`` splits each wire into parallel sub-elements on the direction-tied cap (:mod:`cablexsec.mechanics.progressive_friction`, settings ``progressive``). + ``"auto"`` (opt-in) takes the direction-tied model for a planar + curvature path and the distributed model otherwise, where it applies + (see :func:`compute_fatigue`). ``direction_hold_fraction`` applies to the direction-tied and progressive models. @@ -868,6 +1011,15 @@ def wire_stress_field( bit for bit. """ kx, ky = real_array(kappa_x, "kappa_x"), real_array(kappa_y, "kappa_y") + _check_distributed_bound(distributed_bound) + if friction_model == "auto": + friction_model, _reason = _resolve_friction_model( # type: ignore[assignment] + friction_model, + layer.spec, + curvature_path_out_of_plane_ratio(kx, ky), + stick_modulus_Pa, + friction_law, + ) if ( active_friction_law(friction_law) is not None and isinstance(termination, TerminationSpec) @@ -926,6 +1078,7 @@ def wire_stress_field( friction_out=friction_parts, friction_law=friction_law, time_s=time_s, + distributed_bound=distributed_bound, ) spec = layer.spec increment = None @@ -1145,9 +1298,10 @@ def compute_fatigue( n_fibres: int = 32, rainflow_counter: RainflowCounter = "auto", direction_hold_fraction: float = DIRECTION_HOLD_FRACTION, - friction_model: FrictionModel = "direction_tied", + friction_model: FrictionModel | None = None, distributed_nodes_per_pitch: int | Mapping[str, int] | None = None, distributed_max_increment: float = DEFAULT_MAX_INCREMENT, + distributed_bound: DistributedBound = "signed", copper_contact_model: CopperContactModel = "slip_cycle", partial_slip_cycles: PartialSlipCycles = "skip", termination: TerminationSpec | Mapping[str, TerminationSpec] | None = None, @@ -1192,19 +1346,36 @@ def compute_fatigue( slip-cap bending direction is held (default ``DIRECTION_HOLD_FRACTION``); ``0`` reproduces the earlier update. Used by the direction-tied friction model only. - friction_model : {"direction_tied", "distributed", "progressive"}, optional - Armour friction-stress model. ``"direction_tied"`` (default) is the - pointwise Papailiou cap at the held bending direction + friction_model : {"direction_tied", "auto", "distributed", "progressive"}, optional + Armour friction-stress model. ``"direction_tied"`` (the default, + ``None``) is the pointwise Papailiou cap at the held bending direction (:mod:`cablexsec.mechanics.fast_slip`). ``"distributed"`` solves the elastic--Coulomb friction field along one pitch of the helix with the capstan bound ``mu |sin a|`` and interface stiffness ``k_hat = xi/(1 - xi)`` (:mod:`cablexsec.mechanics.distributed_friction`); it is slower and - requires a constant stick modulus. ``"progressive"`` splits each wire - of the direction-tied law into parallel sub-elements whose caps - average to the same cap + requires a constant stick modulus (a constant one other than the + layer's enters as the Yun coefficient of that state). ``"progressive"`` + splits each wire of the direction-tied law into parallel sub-elements + whose caps average to the same cap (:mod:`cablexsec.mechanics.progressive_friction`, gap G8; settings in - ``progressive``). + ``progressive``). ``"auto"`` (opt-in) takes the direction-tied model + when the curvature path is planar (out-of-plane ratio + :func:`curvature_path_out_of_plane_ratio` at most + ``PLANAR_PATH_TOLERANCE``) and the distributed model otherwise; a + layer that the distributed model does not cover (rigid interface + ``xi >= 1``, a stick modulus that changes over the record, a + rate-dependent friction law) keeps the direction-tied model, and the + provenance records the model of every layer and the reason for such a + fallback. The direction-tied cap turns with the bending direction: + under a steadily rotating curvature its stress ranges fall below those + of the distributed model (to 0.86 of them at twice the slip onset on a + near-rigid interface), while on planar and flat elliptical paths they + are at or above them. The default changes to ``"auto"`` in the next + release: left at its default on a non-planar path (the only case in + which the two differ), the model warns once per call + (:class:`~cablexsec.provenance.DirectionTiedFrictionWarning`, a + ``FutureWarning``); the result of this release is unchanged. distributed_nodes_per_pitch : int, dict[str, int] or None, optional Helix nodes per pitch of the distributed model, for every layer or per layer name (default ``DEFAULT_NODES_PER_WIRE`` times the wire count of @@ -1212,6 +1383,11 @@ def compute_fatigue( distributed_max_increment : float, optional Largest curvature increment per substep of the distributed model, in units of the slip-onset curvature (default ``DEFAULT_MAX_INCREMENT``). + distributed_bound : {"signed", "uniform"}, optional + Friction bound of the distributed model: ``"signed"`` (default) with + the capstan term on the signed bending force of the wire, + ``"uniform"`` without it + (:func:`~cablexsec.mechanics.distributed_friction.distributed_friction_history`). copper_contact_model : {"slip_cycle", "legacy_gross_sliding"}, optional Copper SWT contact branch. ``"slip_cycle"`` (default) counts cycles of the crossing's tangential force, skips cycles without slip and gives @@ -1288,7 +1464,11 @@ def compute_fatigue( :class:`~cablexsec.provenance.UnevaluatedFatigueCurveWarning`. """ compiled = _use_compiled_counter(rainflow_counter) + default_model = friction_model is None + if friction_model is None: + friction_model = "direction_tied" _check_friction_model(friction_model) + _check_distributed_bound(distributed_bound) if copper_contact_model not in COPPER_CONTACT_MODELS: raise CableInputError( f"copper_contact_model must be one of {COPPER_CONTACT_MODELS}, " @@ -1430,6 +1610,11 @@ def compute_fatigue( critical_adjusted_fibre: dict[str, FloatArray] = {} clamp_summary: dict[str, dict[str, float | bool | str]] = {} fibre_angles = np.arange(n_fibres) * (2 * math.pi / n_fibres) + out_of_plane = curvature_path_out_of_plane_ratio(kx, ky) + if default_model: + _warn_default_direction_tied(out_of_plane, stacklevel=2) + chosen_model: dict[str, str] = {} + fallback_reason: dict[str, str] = {} if count_from: for layer in layers: if (layer.swt_const is not None and layer.contact_p0_Pa > 0.0) or ( @@ -1443,6 +1628,13 @@ def compute_fatigue( for layer in layers: spec = layer.spec name = layer.name + layer_stick = None if stick_modulus_Pa is None else stick_modulus_Pa[name] + model, reason = _resolve_friction_model( + friction_model, spec, out_of_plane, layer_stick, friction_law + ) + chosen_model[name] = model + if reason: + fallback_reason[name] = reason layer_termination = ( termination if termination is None or isinstance(termination, TerminationSpec) @@ -1461,13 +1653,12 @@ def compute_fatigue( if normal_stress_Pa is None else normal_stress_Pa[name], wire_modulus_Pa=None if wire_modulus_Pa is None else wire_modulus_Pa[name], - stick_modulus_Pa=None - if stick_modulus_Pa is None - else stick_modulus_Pa[name], + stick_modulus_Pa=layer_stick, direction_hold_fraction=direction_hold_fraction, - friction_model=friction_model, + friction_model=model, # type: ignore[arg-type] distributed_nodes_per_pitch=_layer_nodes(distributed_nodes_per_pitch, name), distributed_max_increment=distributed_max_increment, + distributed_bound=distributed_bound, termination=layer_termination, progressive=progressive, keep_friction=layer.component_scf is not None @@ -1724,10 +1915,27 @@ def compute_fatigue( ), ) prov = _sn_option_provenance(prov, layers) - if friction_model == "distributed": + distributed_layers = [ + lyr for lyr in layers if chosen_model[lyr.name] == "distributed" + ] + if distributed_layers: + # The layer as solved (a constant stick modulus sets its xi). + solved_specs = {} + for lyr in distributed_layers: + stick = None if stick_modulus_Pa is None else stick_modulus_Pa[lyr.name] + usable, _reason = _distributed_spec(lyr.spec, stick, None) + solved_specs[lyr.name] = lyr.spec if usable is None else usable prov = _distributed_provenance( - prov, layers, distributed_nodes_per_pitch, distributed_max_increment + prov, + distributed_layers, + distributed_nodes_per_pitch, + distributed_max_increment, + solved_specs, + distributed_bound, ) + prov = _friction_model_provenance( + prov, friction_model, out_of_plane, chosen_model, fallback_reason + ) if friction_model == "progressive": settings = progressive or ProgressiveFriction() prov = Provenance( @@ -1928,16 +2136,56 @@ def _check_friction_model(friction_model: str) -> None: ) +def _friction_model_provenance( + prov: Provenance, + friction_model: str, + out_of_plane: float, + chosen: Mapping[str, str], + fallback: Mapping[str, str], +) -> Provenance: + """Record the friction model of every layer and the path planarity.""" + method = prov.method + limitations = list(prov.limitations) + planar = out_of_plane <= PLANAR_PATH_TOLERANCE + if friction_model == "auto": + method += ( + "; armour friction model 'auto' (curvature path out-of-plane ratio " + f"{out_of_plane:.3g}, planar at or below {PLANAR_PATH_TOLERANCE:g}): " + + ", ".join(f"{name}: {model}" for name, model in chosen.items()) + ) + limitations.extend( + f"friction_model='auto' kept the direction-tied model for {name} on a " + f"non-planar curvature path because {reason}; the distributed model " + "does not cover that case" + for name, reason in fallback.items() + ) + tied = [name for name in fallback if chosen[name] == "direction_tied"] + if tied and not planar: + limitations.append( + "direction-tied friction cap on a non-planar curvature path " + f"(out-of-plane ratio {out_of_plane:.3g}; layers " + + ", ".join(tied) + + "): the cap turns with the bending direction; " + f"{DIRECTION_TIED_ROTATION_BIAS} (doc/local_analysis_guide.md, " + "Section 9)" + ) + if method == prov.method and len(limitations) == len(prov.limitations): + return prov + return dataclasses.replace(prov, method=method, limitations=tuple(limitations)) + + def _distributed_provenance( prov: Provenance, layers: list[FatigueLayer], nodes_per_pitch: int | Mapping[str, int] | None, max_increment: float, + specs: Mapping[str, HelicalLayerSpec] | None = None, + bound: str = "signed", ) -> Provenance: """Record the distributed friction model and its parameters.""" parts = [] for layer in layers: - spec = layer.spec + spec = layer.spec if specs is None else specs[layer.name] chosen = _layer_nodes(nodes_per_pitch, layer.name) nodes = DEFAULT_NODES_PER_WIRE * spec.n_wires if chosen is None else int(chosen) k_hat = spec.xi / (1.0 - spec.xi) if spec.xi < 1.0 else math.inf @@ -1946,10 +2194,16 @@ def _distributed_provenance( f"{layer.name}: N = {nodes} nodes per pitch, k_hat = {k_hat:.6g}, " f"lam = {lam:.6g}" ) + bound_text = ( + "capstan bound lam = mu |sin a|" + if bound == "signed" + else "uniform bound without the capstan term (stress unit sigma_0 lam, " + "lam = mu |sin a|)" + ) return Provenance( method=prov.method + "; armour friction stress: distributed elastic-Coulomb helix model " - "(friction_model='distributed', capstan bound lam = mu |sin a|, " + f"(friction_model='distributed', {bound_text}, " "interface k_hat = xi/(1 - xi), max increment " f"{max_increment:g} kappa_on; " + "; ".join(parts) + ")", citations=(*prov.citations, "[Papailiou1997]", "[Yun2020]"), diff --git a/src/cablexsec/analysis/frictional_heating.py b/src/cablexsec/analysis/frictional_heating.py index 8ce64c5..3744c5b 100644 --- a/src/cablexsec/analysis/frictional_heating.py +++ b/src/cablexsec/analysis/frictional_heating.py @@ -280,6 +280,24 @@ def anchored_heat_profile( the segment midpoints of the specimen mesh (``segments_per_pitch`` segments per pitch over ``length_m``). The last cycle starts at sample ``last_cycle_start``. + + Bound. The anchored solver has a constant Coulomb bound along the wire + (no capstan term), while the sectional heat ``W_j`` that the ratio + multiplies (:func:`friction_heat`) carries the signed capstan bound. Both + the specimen and its sectional reference are solved with the constant + bound, so the ratio is consistent in itself; the capstan term is not in + it. On a uniformly bent section the signed bound changes the cycle work + by less than 0.25 % against the constant bound (66 kV template armour, + planar cycles from 1.2 to 32 times the slip onset; less than 0.04 % in + the distributed model, + :func:`~cablexsec.mechanics.distributed_friction.distributed_friction_history` + with ``bound="uniform"``). Near an anchor the mean wire force reaches + about ``0.85 sqrt(a)`` times the bound per radian + (:mod:`cablexsec.mechanics.clamp_layer`), where a capstan term would move + the local bound by up to ``lam 0.85 sqrt(a)`` (0.2 at ``a = 30``, + ``lam = 0.045``); that part of the ratio is a constant-bound estimate. A + capstan bound breaks the translation invariance on which the exact chain + projection of the solver rests, so it is not offered here. """ for name, value in ( ("pitch_m", pitch_m), diff --git a/src/cablexsec/analysis/thermal_coupling.py b/src/cablexsec/analysis/thermal_coupling.py index bcce6a0..9935bf0 100644 --- a/src/cablexsec/analysis/thermal_coupling.py +++ b/src/cablexsec/analysis/thermal_coupling.py @@ -21,14 +21,17 @@ the frictional work is reported as a diagnostic only. The work is the dissipation of the distributed helix friction model (:func:`~cablexsec.mechanics.distributed_friction.distributed_friction_history`), -whatever friction law the fatigue stresses use. The direction-tied cap of the -default fatigue path re-orients with the bending direction, and under rotating -curvature it under-counts the dissipation: on a circular orbit its work is -0.16 of the distributed model's at twice the slip onset, 0.39 at eight times, -and tends to 0.57 at large amplitude -(:func:`~cablexsec.mechanics.papailiou.wire_slip_history`). Its wire stress -ranges agree with the distributed model within 10 %, and in planar bending the -two models dissipate the same work within 3 % from twice the slip onset. +whatever friction law the fatigue stresses use. The direction-tied cap +re-orients with the bending direction, and under rotating curvature it +under-counts the dissipation: on a circular orbit its work is 0.16 of the +distributed model's at twice the slip onset, 0.39 at eight times, and tends +to 0.57 at large amplitude +(:func:`~cablexsec.mechanics.papailiou.wire_slip_history`). On such orbits its +wire stress ranges are also low (0.86 to 0.94 of the distributed ones at twice +the slip onset), which is why the fatigue path warns when its default +direction-tied law meets a non-planar path and offers ``friction_model="auto"``; +in planar bending the two models dissipate the same work within 3 % from twice +the slip onset. What a temperature does to the mechanics (per block): diff --git a/src/cablexsec/api.py b/src/cablexsec/api.py index 4127fe5..cb7d9fe 100644 --- a/src/cablexsec/api.py +++ b/src/cablexsec/api.py @@ -76,10 +76,13 @@ from cablexsec.analysis.electrical_life import LifeResult, compute_electrical_life from cablexsec.analysis.fatigue import ( CopperContactModel, + DistributedBound, FatigueLayer, FatigueResult, FrictionModel, RainflowCounter, + _warn_default_direction_tied, + curvature_path_out_of_plane_ratio, rainflow_cycles, ) from cablexsec.analysis.fatigue import ( @@ -1957,9 +1960,10 @@ def compute_fatigue( section_states: Sequence[SectionState] | None = None, n_fibres: int = 32, rainflow_counter: RainflowCounter = "auto", - friction_model: FrictionModel = "direction_tied", + friction_model: FrictionModel | None = None, distributed_nodes_per_pitch: int | Mapping[str, int] | None = None, distributed_max_increment: float = DEFAULT_MAX_INCREMENT, + distributed_bound: DistributedBound = "signed", copper_contact_model: CopperContactModel = "slip_cycle", partial_slip_cycles: PartialSlipCycles = "skip", termination: TerminationSpec | Mapping[str, TerminationSpec] | None = None, @@ -2055,9 +2059,10 @@ def compute_fatigue( compiled counter when numba is active and the reference counter otherwise; both give the same damage. See :func:`cablexsec.analysis.fatigue.compute_fatigue`. - friction_model : {"direction_tied", "distributed", "progressive"}, optional - Armour friction-stress model. The default ``"direction_tied"`` keeps the - pointwise Papailiou cap at the held bending direction. ``"progressive"`` + friction_model : {"direction_tied", "auto", "distributed", "progressive"}, optional + Armour friction-stress model. ``"direction_tied"`` (the default, + ``None``) keeps the pointwise Papailiou cap at the held bending + direction. ``"progressive"`` splits each wire of that law into parallel sub-elements whose caps average to the same cap (gap G8; settings ``progressive``, default the friction-continuity density). ``"distributed"`` @@ -2065,13 +2070,29 @@ def compute_fatigue( layer with the capstan bound ``mu |sin a|`` and the Yun interface stiffness ``xi/(1 - xi)``; the model and its parameters are recorded in ``provenance``. It requires a constant stick modulus over - ``section_states``. + ``section_states`` and a thermal history (one ``ThermalState`` per + call). ``"auto"`` (opt-in) takes the direction-tied model for a + planar curvature path and the distributed model for any other, where + it applies: the direction-tied cap turns with the bending direction + and under rotating curvature gives friction-stress ranges below those + of the distributed model. The model of every layer is recorded in + ``provenance``. The default changes to ``"auto"`` in the next + release: left at its default on a non-planar path (the only case in + which the two differ), the direction-tied model warns once per call + (:class:`~cablexsec.provenance.DirectionTiedFrictionWarning`, a + ``FutureWarning``, with the measured bias); the result of this + release is unchanged. See + :func:`cablexsec.analysis.fatigue.compute_fatigue`. distributed_nodes_per_pitch : int, dict[str, int] or None, optional Helix nodes per pitch for the distributed model (all layers or per layer; default four per wire). distributed_max_increment : float, optional Largest curvature increment per substep of the distributed model, in units of the slip-onset curvature (default 0.1). + distributed_bound : {"signed", "uniform"}, optional + Friction bound of the distributed model: ``"signed"`` (default, the + capstan term on the signed bending force of the wire) or + ``"uniform"`` (no capstan term). progressive : ProgressiveFriction, optional Settings of the progressive law; only with ``friction_model="progressive"``. @@ -2166,6 +2187,13 @@ def compute_fatigue( ) require_finite(kx, "kappa_x") require_finite(ky, "kappa_y") + if friction_model is None: + # The default law, with a warning on a non-planar path (once per call). + friction_model = "direction_tied" + # stacklevel 3: this function, its material-scope wrapper, the caller. + _warn_default_direction_tied( + curvature_path_out_of_plane_ratio(kx, ky), stacklevel=3 + ) if thermal is not None: if contact_model is None: contact_model = "solved" @@ -2313,6 +2341,7 @@ def compute_fatigue( friction_model=friction_model, distributed_nodes_per_pitch=distributed_nodes_per_pitch, distributed_max_increment=distributed_max_increment, + distributed_bound=distributed_bound, copper_contact_model=copper_contact_model, partial_slip_cycles=partial_slip_cycles, termination=termination, @@ -2358,7 +2387,14 @@ def compute_fatigue( inputs = thermal_fatigue_inputs( cable, layers, kx.size, tension, thermal, time_s=thermal_time_s ) - if inputs.stick_modulus_Pa is not None and friction_model == "distributed": + if ( + inputs.stick_modulus_Pa is not None + and friction_model == "distributed" + and any( + not np.allclose(v, v[0], rtol=1e-12, atol=0.0) + for v in inputs.stick_modulus_Pa.values() + ) + ): raise CableSchemaError( "the distributed friction model needs a constant stick modulus; " "the thermal history changes it between blocks (use one " @@ -2393,6 +2429,7 @@ def compute_fatigue( friction_model=friction_model, distributed_nodes_per_pitch=distributed_nodes_per_pitch, distributed_max_increment=distributed_max_increment, + distributed_bound=distributed_bound, copper_contact_model=copper_contact_model, partial_slip_cycles=partial_slip_cycles, termination=termination, @@ -2558,6 +2595,7 @@ def _fatigue_from_section_states( friction_model: FrictionModel = "direction_tied", distributed_nodes_per_pitch: int | Mapping[str, int] | None = None, distributed_max_increment: float = DEFAULT_MAX_INCREMENT, + distributed_bound: DistributedBound = "signed", copper_contact_model: CopperContactModel = "slip_cycle", partial_slip_cycles: PartialSlipCycles = "skip", termination: TerminationSpec | Mapping[str, TerminationSpec] | None = None, @@ -2630,6 +2668,7 @@ def _fatigue_from_section_states( friction_model=friction_model, distributed_nodes_per_pitch=distributed_nodes_per_pitch, distributed_max_increment=distributed_max_increment, + distributed_bound=distributed_bound, copper_contact_model=copper_contact_model, partial_slip_cycles=partial_slip_cycles, termination=termination, diff --git a/src/cablexsec/mechanics/distributed_friction.py b/src/cablexsec/mechanics/distributed_friction.py index 6f57da4..90e0ff4 100644 --- a/src/cablexsec/mechanics/distributed_friction.py +++ b/src/cablexsec/mechanics/distributed_friction.py @@ -3,12 +3,14 @@ r"""Distributed elastic--Coulomb friction along the helix of one armour layer. Alternative to the direction-tied pointwise cap of -:mod:`cablexsec.mechanics.fast_slip` (``friction_model="direction_tied"``, -the default). Here the axial force of a wire is solved as a field along one -pitch of its helix, with interface shear compliance and the Papailiou capstan -bound, so that stick zones anchor the force distribution for arbitrary biaxial +:mod:`cablexsec.mechanics.fast_slip` (``friction_model="direction_tied"``). +Here the axial force of a wire is solved as a field along one pitch of its +helix, with interface shear compliance and the Papailiou capstan bound, so +that stick zones anchor the force distribution for arbitrary biaxial curvature histories. No bending direction is needed: the model has no -held-direction rule. +held-direction rule. The fatigue option ``friction_model="auto"`` uses it +for every non-planar curvature path and the direction-tied cap for planar +ones. Model (normalised; one wire on a rigid core, uniform curvature, periodic over one pitch, axial slip only):: @@ -24,7 +26,8 @@ ``xi``-reduced stick stiffness of the package), ``lam = mu |sin a|`` (capstan bound on the signed force: a rising force raises its normal load, a falling one lowers it, as in [Papailiou1997] Eqs. 9-14 with the signed helix angle; -``b`` is floored at zero; ``lam -> 0`` is the constant bound), +``b`` is floored at zero; ``lam -> 0`` is the constant bound, available as +``bound="uniform"``), ``rho = P(t) / P_ref`` the clamping-pressure ratio and ``g(phi)`` the optional azimuthal contact shape (periodic linear interpolation of ``shape_g``). The wire stress is @@ -96,6 +99,7 @@ from cablexsec.mechanics.mkappa import HelicalLayerSpec __all__ = [ + "BOUND_FORMS", "DEFAULT_MAX_INCREMENT", "DEFAULT_NODES_PER_WIRE", "FRICTION_MODELS", @@ -107,8 +111,13 @@ FloatArray = NDArray[np.float64] -#: Accepted values of the ``friction_model`` option of the fatigue path. -FRICTION_MODELS = ("direction_tied", "distributed", "progressive") +#: Accepted values of the ``friction_model`` option of the fatigue path +#: (``"auto"`` is resolved per layer by :mod:`cablexsec.analysis.fatigue`). +FRICTION_MODELS = ("direction_tied", "auto", "distributed", "progressive") +#: Forms of the friction bound of the distributed model: ``"signed"`` (capstan +#: term ``lam n`` on the signed bending force of the wire, the default) and +#: ``"uniform"`` (no capstan term, ``b = rho g``). +BOUND_FORMS = ("signed", "uniform") #: Default helix nodes per wire (``N = DEFAULT_NODES_PER_WIRE * n_wires``). DEFAULT_NODES_PER_WIRE = 4 #: Default largest curvature increment per substep, in units of ``kappa_on``. @@ -1095,6 +1104,7 @@ def distributed_friction_history( field_samples: NDArray[np.int64] | None = None, friction_law: FrictionLaw | None = None, time_s: FloatArray | None = None, + bound: str = "signed", ) -> DistributedFrictionHistory: """Friction stress of every wire from the distributed helix model [Pa]. @@ -1141,7 +1151,21 @@ def distributed_friction_history( time_s : numpy.ndarray, optional Sample times [s] for a finite positive healing time; each sample step is divided equally among its substeps. + bound : {"signed", "uniform"}, optional + Form of the friction bound. ``"signed"`` (default) is + ``b = rho g + lam n`` with the capstan term on the signed bending + force ``n`` of the wire (module notes). ``"uniform"`` drops the + capstan term, ``b = rho g``: the linear Coulomb bound of the clamping + alone, for sensitivity studies and for comparison with solvers that + carry a constant bound (:mod:`cablexsec.mechanics.clamp_layer`). The + stress unit ``sigma_0 lam`` and the slip-onset curvature are the same + in both forms. A bound on the total wire force (bending plus tension + share) is not offered: the clamping history ``P(t)`` that scales ``g`` + already contains the radial load of the tension share, which a + capstan term on the tension share would count a second time. """ + if bound not in BOUND_FORMS: + raise CableInputError(f"bound must be one of {BOUND_FORMS}, got {bound!r}") kx = np.ascontiguousarray(kappa_x, dtype=np.float64) ky = np.ascontiguousarray(kappa_y, dtype=np.float64) if ( @@ -1201,6 +1225,9 @@ def distributed_friction_history( n_w = int(spec.n_wires) width = 2.0 * math.pi * spec.r_helix_m / n_w lam = mu * sin_a + # Capstan coefficient of the bound (zero for the uniform bound); ``lam`` + # itself also sets the stress unit sigma_0 lam of both forms. + capstan = lam if bound == "signed" else 0.0 zero = xi == 0.0 or mu == 0.0 or sin_a < 1.0e-12 or p_ref <= 0.0 sigma0 = ( 0.0 @@ -1219,6 +1246,7 @@ def distributed_friction_history( "xi": xi, "k_hat": math.inf if xi >= 1.0 else xi / (1.0 - xi), "lam": lam, + "bound": bound, "reference_pressure_Pa": p_ref, "stress_unit_Pa": stress_unit, } @@ -1273,7 +1301,7 @@ def distributed_friction_history( ky / kappa_c, pressure / p_ref, khat, - lam, + capstan, gnode, 0.0, xi, @@ -1293,7 +1321,7 @@ def distributed_friction_history( ky / kappa_c, pressure / p_ref, khat, - lam, + capstan, gnode, 0.0, xi, @@ -1316,7 +1344,7 @@ def distributed_friction_history( ky / kappa_c, pressure / p_ref, khat, - lam, + capstan, gnode, 0.0, xi, @@ -1381,6 +1409,7 @@ def distributed_wire_friction_stress( max_increment: float = DEFAULT_MAX_INCREMENT, friction_law: FrictionLaw | None = None, time_s: FloatArray | None = None, + bound: str = "signed", ) -> FloatArray: """Friction stress [Pa], shape (wires, samples); see :func:`distributed_friction_history`.""" @@ -1394,4 +1423,5 @@ def distributed_wire_friction_stress( max_increment=max_increment, friction_law=friction_law, time_s=time_s, + bound=bound, ).stress_Pa diff --git a/src/cablexsec/mechanics/papailiou.py b/src/cablexsec/mechanics/papailiou.py index 376f7e8..0d7df51 100644 --- a/src/cablexsec/mechanics/papailiou.py +++ b/src/cablexsec/mechanics/papailiou.py @@ -797,12 +797,37 @@ def wire_slip_history( ``pi / 4`` for any ``lam``. The direction-tied work is thus 0.57 of the distributed work at large amplitude, and less closer to slip onset (0.16 at twice the onset and 0.39 at eight times on the 66 kV template). The - per-wire stress ranges, which fatigue uses, agree with the distributed - model within 10 % on the same orbits: the cap bounds the stress amplitude - much as the distributed bound does, but narrows the stress-drive loop of - each wire. Frictional heat uses the distributed dissipation + per-wire stress ranges, which fatigue uses, are also low on such orbits: + at twice the slip onset the largest one is 0.94 of the distributed model's + on the template interface of the 66 kV inner armour (``xi = 0.81``) and + 0.86 on a near-rigid one (``xi = 0.99``), and 0.97 to 1.00 at eight times + the onset. On planar and flat elliptical paths (minor over major axis up + to about 0.3) they are at or above the distributed ranges instead. + :func:`~cablexsec.analysis.fatigue.compute_fatigue` therefore offers + ``friction_model="auto"``, which takes the distributed model for every + such path and becomes its default in the next release; until then its + default (this law) warns on a non-planar path + (:class:`~cablexsec.provenance.DirectionTiedFrictionWarning`). + Frictional heat uses the distributed dissipation (:func:`~cablexsec.analysis.thermal_coupling.record_friction_work`). + Pitch mean. The bounds integrate the capstan growth from the neutral + axis, where the friction stress is zero ([Papailiou1997] Eq. 14). In + planar full slip the stress of a wire at the azimuth ``x`` from the + neutral axis toward tension is ``sigma_0 (exp(lam x) - 1)`` on both sides, + whose mean over the pitch is ``sigma_0 (sinh(x0)/x0 - 1)``, + ``x0 = lam pi / 2``: ``lam pi / 12`` of the peak tensile friction stress + to leading order (1.1 % on the 66 kV inner armour, 0.054 MPa), whereas + the periodic friction field of a uniformly bent pitch has zero mean (the + distributed model, ``sigma_0 (C exp(lam x) - 1)``). The offset is kept: a + zero-mean condition couples the wires of a layer, which the independent + spring-sliders of this model do not, and a uniform shift that removed it + would move the wire stresses out of their own bounds. Its effect is + small: it leaves the moment unchanged (the wires are equally spaced), it + changes the largest per-wire stress range by less than 1e-4 (66 kV + template, planar, one-sided and rotating cycles from twice to 32 times + the onset) and it raises the mean stress of every wire by the offset. + Friction law. ``friction_law`` (:class:`~cablexsec.mechanics.friction_law.FrictionLaw`) scales the coefficient of every wire by its static, dynamic and rate factor: the diff --git a/src/cablexsec/provenance.py b/src/cablexsec/provenance.py index 9e8f2c6..1d5cbf1 100644 --- a/src/cablexsec/provenance.py +++ b/src/cablexsec/provenance.py @@ -46,6 +46,7 @@ from cablexsec.exceptions import PhysicalRangeError __all__ = [ + "DirectionTiedFrictionWarning", "ExtrapolationWarning", "MissingClampingStateWarning", "Provenance", @@ -66,6 +67,26 @@ class ExtrapolationWarning(UserWarning): """ +class DirectionTiedFrictionWarning(FutureWarning): + """The default armour friction law of the fatigue path will change. + + Emitted once per call by :func:`cablexsec.api.compute_fatigue` and + :func:`cablexsec.analysis.fatigue.compute_fatigue` when ``friction_model`` + is left at its default and the curvature path is not planar + (:func:`cablexsec.analysis.fatigue.curvature_path_out_of_plane_ratio` + above :data:`cablexsec.analysis.fatigue.PLANAR_PATH_TOLERANCE`). The + default changes from ``"direction_tied"`` to ``"auto"`` in the next + release; on a planar path the two are the same, bit for bit, so only + non-planar paths warn. The direction-tied cap turns with the bending + direction, and under rotating curvature its friction-stress ranges fall + below those of the distributed helix model (the message gives the + measured bias). The result of this release is the direction-tied one, + unchanged. Pass ``friction_model`` explicitly to keep the current + behaviour (``"direction_tied"``) or to take the coming one (``"auto"``) + without the warning. + """ + + class UnevaluatedFatigueCurveWarning(UserWarning): """A cable layer declares an S-N or contact-life curve that is not evaluated. diff --git a/tests/test_biaxial_friction_default.py b/tests/test_biaxial_friction_default.py new file mode 100644 index 0000000..a0c32e3 --- /dev/null +++ b/tests/test_biaxial_friction_default.py @@ -0,0 +1,447 @@ +# SPDX-License-Identifier: Apache-2.0 +# Copyright (c) 2026 Jae Hoon Seo, SMI Lab, Inha University +"""Armour friction model of the fatigue path under biaxial curvature. + +Gates: + +* the out-of-plane ratio of a curvature path: zero for a planar path in any + plane (and below the tolerance after rounding to six digits), ``b/a`` for + an ellipse, one for a circle, scale invariant; +* the default of ``compute_fatigue`` stays the direction-tied model, bit + for bit (results and provenance), and warns once per call + (``DirectionTiedFrictionWarning``, a ``FutureWarning`` announcing the + change of the default to ``"auto"``) only when it is left at the default + on a non-planar path; +* ``friction_model="auto"`` (opt-in) is the direction-tied model on planar + paths, bit for bit, and the distributed helix model on any other path, + bit for bit; +* under steadily rotating curvature at twice the slip onset the + direction-tied cap gives worst-wire friction-stress ranges below the + distributed model (0.86 of them on a near-rigid interface, 0.94 on the + template interface of the 66 kV inner armour) and too little friction + work (0.38-0.69 of the planar cycle against 1.8-2.6 for the distributed + model); on planar and flat elliptical paths its ranges are at or above + the distributed ones; +* layers the distributed model does not cover keep the direction-tied model + and say why; a constant stick modulus other than the layer's enters as the + Yun coefficient of that state; +* the bound form of the distributed model: the uniform bound gives the + linear Coulomb full-slip field ``sigma_0 lam x``, the same cycle work as + the signed bound within 1e-3, and the signed default is unchanged; +* the documented pitch-mean offset of the direction-tied cap in planar full + slip, ``sigma_0 (sinh x0 / x0 - 1)``, ``x0 = lam pi / 2``. +""" + +from __future__ import annotations + +import math +import warnings +from dataclasses import replace + +import numpy as np +import pytest + +import cablexsec as cx +from cablexsec.analysis.fatigue import ( + PLANAR_PATH_TOLERANCE, + compute_fatigue, + curvature_path_out_of_plane_ratio, + wire_stress_field, +) +from cablexsec.cable_adapters import cable_to_fatigue_layers +from cablexsec.exceptions import CableInputError +from cablexsec.mechanics.distributed_friction import ( + HAVE_NUMBA, + distributed_friction_history, +) +from cablexsec.mechanics.friction_law import FrictionLaw +from cablexsec.mechanics.papailiou import slip_onset_curvature, wire_slip_history +from cablexsec.provenance import DirectionTiedFrictionWarning + +compiled = pytest.mark.skipif( + not HAVE_NUMBA, reason="long friction histories need the compiled kernels" +) + +POINTS = 360 # samples per revolution or cycle +TEMPLATE_XI = None # keep the template interface (xi = 0.813, inner armour) + + +@pytest.fixture(scope="module") +def inner(): + cable = cx.load_cable(cx.iea_task49_66kv_yaml_path(), geometry_override=None) + with warnings.catch_warnings(): + warnings.simplefilter("ignore") + return cable_to_fatigue_layers(cable, contact_tension_N=100e3)[0] + + +def _with_xi(layer, xi): + return layer if xi is None else replace(layer, spec=replace(layer.spec, xi=xi)) + + +def _orbit(radius, ry, revolutions=4, ramp=90): + """Ramp to ``(radius, 0)``, then ellipses of semi-axes ``radius``, ``ry radius``.""" + th = np.linspace(0.0, 2.0 * math.pi * revolutions, revolutions * POINTS + 1) + r = np.linspace(0.0, radius, ramp + 1)[:-1] + return ( + np.r_[r, radius * np.cos(th)], + np.r_[0.0 * r, ry * radius * np.sin(th)], + ) + + +def _worst_range(stress): + tail = stress[:, -POINTS - 1 :] + return float(np.max(tail.max(axis=1) - tail.min(axis=1))) + + +def _friction_range(layer, kx, ky, model): + field = wire_stress_field(layer, kx, ky, friction_model=model, keep_friction=True) + assert field.friction_Pa is not None + return _worst_range(field.friction_Pa) + + +def _last_cycle(cumulative): + return float(cumulative[-1] - cumulative[-1 - POINTS]) + + +# --------------------------------------------------------------------------- # +# planarity # +# --------------------------------------------------------------------------- # +def test_out_of_plane_ratio(): + t = np.linspace(0.0, 30.0, 3001) + s = 0.01 * np.sin(t) * (1.0 + 0.3 * np.sin(0.21 * t)) + for angle in (0.0, 0.4, math.pi / 2, 2.0, -2.9): + kx, ky = s * math.cos(angle), s * math.sin(angle) + assert curvature_path_out_of_plane_ratio(kx, ky) < 1e-15 + # Output rounded to six significant digits stays planar. + rx = np.array([float(f"{v:.6g}") for v in kx]) + ry = np.array([float(f"{v:.6g}") for v in ky]) + assert curvature_path_out_of_plane_ratio(rx, ry) < 1e-5 + th = np.linspace(0.0, 2.0 * math.pi, 721) + for ratio in (1e-4, 0.1, 0.5, 1.0): + kx, ky = 0.02 * np.cos(th), ratio * 0.02 * np.sin(th) + # Rotate the ellipse: the measure has no preferred axis. + c, sn = math.cos(1.1), math.sin(1.1) + value = curvature_path_out_of_plane_ratio(c * kx - sn * ky, sn * kx + c * ky) + assert value == pytest.approx(ratio, rel=1e-9, abs=1e-15) + for scale in (1e-200, 1e200): + assert curvature_path_out_of_plane_ratio( + scale * kx, scale * ky + ) == pytest.approx(ratio, rel=1e-9, abs=1e-15) + assert curvature_path_out_of_plane_ratio(np.zeros(5), np.zeros(5)) == 0.0 + assert curvature_path_out_of_plane_ratio(np.zeros(0), np.zeros(0)) == 0.0 + with pytest.raises(CableInputError, match="same shape"): + curvature_path_out_of_plane_ratio(np.zeros(3), np.zeros(4)) + # A static offset in y with cycling in x is not planar. + assert curvature_path_out_of_plane_ratio(np.sin(th), np.full(th.size, 0.5)) > 0.1 + assert curvature_path_out_of_plane_ratio(np.sin(th), 2e-3 * np.cos(th)) > ( + PLANAR_PATH_TOLERANCE + ) + + +# --------------------------------------------------------------------------- # +# the default # +# --------------------------------------------------------------------------- # +def _damage_equal(a, b): + assert a.D_total_per_wire.keys() == b.D_total_per_wire.keys() + for name in a.D_total_per_wire: + assert np.array_equal(a.D_total_per_wire[name], b.D_total_per_wire[name]) + assert np.array_equal(a.D_bulk_per_fibre[name], b.D_bulk_per_fibre[name]) + + +def _calls(record): + return [w for w in record if issubclass(w.category, DirectionTiedFrictionWarning)] + + +def test_default_stays_direction_tied_and_warns_on_non_planar_paths(inner): + on = slip_onset_curvature(inner.spec) + cable = cx.load_cable(cx.iea_task49_66kv_yaml_path(), geometry_override=None) + for ry in (0.0, 0.5): + kx, ky = _orbit(2.0 * on, ry, revolutions=1) + with warnings.catch_warnings(record=True) as record: + warnings.simplefilter("always") + default = compute_fatigue([inner], kx, ky) + explicit = compute_fatigue([inner], kx, ky, friction_model="direction_tied") + public = cx.compute_fatigue(cable, kx, ky, contact_tension_N=1e5) + public_explicit = cx.compute_fatigue( + cable, kx, ky, contact_tension_N=1e5, friction_model="direction_tied" + ) + _damage_equal(default, explicit) + _damage_equal(public, public_explicit) + assert default.provenance == explicit.provenance + assert public.provenance == public_explicit.provenance + assert "'auto'" not in default.provenance.method + calls = _calls(record) + assert not any("non-planar" in x for x in default.provenance.limitations) + if ry == 0.0: + assert not calls + else: + # Once per call, at the caller's line, for the two default calls. + assert len(calls) == 2 + assert all(w.filename == __file__ for w in calls) + text = str(calls[0].message) + assert "will change from 'direction_tied' to 'auto'" in text + assert "0.86" in text and "0.94" in text + assert issubclass(DirectionTiedFrictionWarning, FutureWarning) + + +def test_auto_is_direction_tied_on_planar_paths(inner): + on = slip_onset_curvature(inner.spec) + kx, ky = _orbit(3.0 * on, 0.0, revolutions=2) + for angle in (0.0, 0.9): + x, y = kx * math.cos(angle), kx * math.sin(angle) + auto = compute_fatigue([inner], x, y, friction_model="auto") + explicit = compute_fatigue([inner], x, y, friction_model="direction_tied") + _damage_equal(auto, explicit) + method = auto.provenance.method + assert "'auto'" in method and "inner_armour: direction_tied" in method + assert not any("non-planar" in x for x in auto.provenance.limitations) + field = wire_stress_field(inner, kx, ky, friction_model="auto") + tied = wire_stress_field(inner, kx, ky) + assert np.array_equal(field.mean_Pa, tied.mean_Pa) + + +@compiled +@pytest.mark.independent_method +def test_auto_is_distributed_on_biaxial_paths(inner): + on = slip_onset_curvature(inner.spec) + kx, ky = _orbit(2.0 * on, 0.5, revolutions=2) + default = compute_fatigue([inner], kx, ky, friction_model="auto") + distributed = compute_fatigue([inner], kx, ky, friction_model="distributed") + _damage_equal(default, distributed) + assert "inner_armour: distributed" in default.provenance.method + assert "distributed elastic-Coulomb helix model" in default.provenance.method + tied = compute_fatigue([inner], kx, ky, friction_model="direction_tied") + assert not any("non-planar" in x for x in tied.provenance.limitations) + field = wire_stress_field(inner, kx, ky, friction_model="auto") + helix = wire_stress_field(inner, kx, ky, friction_model="distributed") + assert np.array_equal(field.mean_Pa, helix.mean_Pa) + + +@compiled +@pytest.mark.independent_method +@pytest.mark.parametrize( + ("xi", "rotation_ceiling"), + [(0.99, 0.90), (TEMPLATE_XI, 0.97)], + ids=["near_rigid", "template"], +) +def test_rotation_direction_tied_below_distributed(inner, xi, rotation_ceiling): + layer = _with_xi(inner, xi) + on = slip_onset_curvature(layer.spec) + ratios = {} + for label, ry in (("circle", 1.0), ("ellipse", 0.5), ("planar", 0.0)): + kx, ky = _orbit(2.0 * on, ry) + tied = _friction_range(layer, kx, ky, "direction_tied") + helix = _friction_range(layer, kx, ky, "distributed") + ratios[label] = tied / helix + assert _friction_range(layer, kx, ky, "auto") == (helix if ry > 0 else tied) + # Measured: 0.863 (near rigid) and 0.943 (template) on the circle. + assert ratios["circle"] < rotation_ceiling + # Flat ellipses and planar paths: the direction-tied ranges are not lower. + assert ratios["ellipse"] >= 1.0 + assert ratios["planar"] >= 1.0 + assert ratios["planar"] < 1.1 + + +@compiled +@pytest.mark.independent_method +@pytest.mark.parametrize("amplitude", [2.0, 8.0]) +def test_rotation_friction_work_against_planar(inner, amplitude): + layer = _with_xi(inner, 0.99) + spec = layer.spec + on = slip_onset_curvature(spec) + work = {} + for label, ry in (("circle", 1.0), ("planar", 0.0)): + kx, ky = _orbit(amplitude * on, ry) + work[label] = ( + _last_cycle(wire_slip_history(spec, kx, ky).work.friction_J_per_m), + _last_cycle(distributed_friction_history(spec, kx, ky).dissipation_J_per_m), + ) + tied = work["circle"][0] / work["planar"][0] + helix = work["circle"][1] / work["planar"][1] + # Measured: 0.38 and 0.69 (direction-tied), 2.62 and 1.82 (distributed). + assert tied < 0.75 + assert helix > 1.75 + + +# --------------------------------------------------------------------------- # +# fallbacks # +# --------------------------------------------------------------------------- # +def _short_rotation(layer, n=48): + on = slip_onset_curvature(layer.spec) + th = np.linspace(0.0, 2.0 * math.pi, n) + return 2.0 * on * np.cos(th), 2.0 * on * np.sin(th) + + +def _fallback_case(result, explicit, reason): + _damage_equal(result, explicit) + assert "inner_armour: direction_tied" in result.provenance.method + notes = [x for x in result.provenance.limitations if "kept the direction" in x] + assert len(notes) == 1 and reason in notes[0] + assert any("non-planar" in x for x in result.provenance.limitations) + + +def test_rigid_interface_keeps_direction_tied(inner): + rigid = _with_xi(inner, 1.0) + kx, ky = _short_rotation(rigid) + result = compute_fatigue([rigid], kx, ky, friction_model="auto") + explicit = compute_fatigue([rigid], kx, ky, friction_model="direction_tied") + _fallback_case(result, explicit, "rigid") + + +def test_rate_dependent_law_keeps_direction_tied(inner): + kx, ky = _short_rotation(inner) + law = FrictionLaw(rate_coefficient=0.05) + time = np.linspace(0.0, 10.0, kx.size) + result = compute_fatigue( + [inner], kx, ky, friction_law=law, time_s=time, friction_model="auto" + ) + explicit = compute_fatigue( + [inner], kx, ky, friction_law=law, time_s=time, friction_model="direction_tied" + ) + _fallback_case(result, explicit, "rate dependent") + + +def test_varying_stick_modulus_keeps_direction_tied(inner): + kx, ky = _short_rotation(inner) + stick = {"inner_armour": inner.spec.k_f * np.linspace(1.0, 0.9, kx.size)} + result = compute_fatigue( + [inner], kx, ky, stick_modulus_Pa=stick, friction_model="auto" + ) + explicit = compute_fatigue( + [inner], kx, ky, stick_modulus_Pa=stick, friction_model="direction_tied" + ) + _fallback_case(result, explicit, "stick modulus changes") + + +@compiled +def test_constant_stick_modulus_is_the_yun_coefficient(inner): + kx, ky = _short_rotation(inner, 120) + factor = 0.9 + stick = {"inner_armour": np.full(kx.size, factor * inner.spec.k_f)} + result = compute_fatigue( + [inner], kx, ky, stick_modulus_Pa=stick, friction_model="auto" + ) + spec = inner.spec + # The Yun coefficient of that stick modulus, k / (E cos^2 a). + xi = factor * spec.k_f / (spec.E_wire_Pa * math.cos(spec.lay_angle_rad) ** 2) + assert xi == pytest.approx(factor * spec.xi, rel=1e-14) + softer = _with_xi(inner, xi) + reference = compute_fatigue([softer], kx, ky, friction_model="distributed") + _damage_equal(result, reference) + assert "inner_armour: distributed" in result.provenance.method + assert f"k_hat = {softer.spec.xi / (1 - softer.spec.xi):.6g}" in str( + result.provenance + ) + explicit = compute_fatigue( + [inner], kx, ky, stick_modulus_Pa=stick, friction_model="distributed" + ) + _damage_equal(explicit, reference) + + +def test_progressive_settings_still_need_progressive(inner): + from cablexsec.mechanics.progressive_friction import ProgressiveFriction + + kx, ky = _short_rotation(inner) + with pytest.raises(CableInputError, match="progressive"): + compute_fatigue( + [inner], kx, ky, progressive=ProgressiveFriction(), friction_model="auto" + ) + + +# --------------------------------------------------------------------------- # +# bound form of the distributed model # +# --------------------------------------------------------------------------- # +def test_bound_option_validation(inner): + kx, ky = _short_rotation(inner, 8) + with pytest.raises(CableInputError, match="bound"): + distributed_friction_history(inner.spec, kx, ky, bound="total") + with pytest.raises(CableInputError, match="distributed_bound"): + compute_fatigue([inner], kx, ky, distributed_bound="total") + with pytest.raises(CableInputError, match="distributed_bound"): + wire_stress_field(inner, kx, ky, distributed_bound="total") + + +@compiled +@pytest.mark.analytical_sanity +def test_uniform_bound_full_slip_field_is_linear_coulomb(inner): + spec = inner.spec + on = slip_onset_curvature(spec) + amplitude = 400.0 * on + kx = np.linspace(0.0, amplitude, 801) + uniform = distributed_friction_history(spec, kx, 0.0 * kx, bound="uniform") + signed = distributed_friction_history(spec, kx, 0.0 * kx) + unit = uniform.parameters["stress_unit_Pa"] + assert unit == signed.parameters["stress_unit_Pa"] + assert uniform.parameters["bound"] == "uniform" + assert signed.parameters["bound"] == "signed" + # Azimuth from the neutral axis toward the tension side (phi = 0). + phi = np.angle(np.exp(1j * spec.phi_wires)) + x = math.pi / 2.0 - np.abs(phi) + # The elastic interface rounds the field over O(kappa_on / kappa) radians. + assert np.max(np.abs(uniform.stress_Pa[:, -1] / unit - x)) < 2e-2 + lam = uniform.parameters["lam"] + c = lam * math.pi / (2.0 * math.sinh(lam * math.pi / 2.0)) + sigma0 = unit / lam + closed = sigma0 * (c * np.exp(lam * x) - 1.0) + assert np.max(np.abs(signed.stress_Pa[:, -1] - closed)) < 2e-2 * unit + # Both full-slip fields span the linear Coulomb range sigma_0 lam pi. + for history in (uniform, signed): + span = np.ptp(history.stress_Pa[:, -1]) + assert span == pytest.approx(unit * math.pi, rel=2e-2) + + +@compiled +@pytest.mark.independent_method +def test_uniform_bound_cycle_work_matches_signed(inner): + spec = inner.spec + on = slip_onset_curvature(spec) + for amplitude in (2.0, 32.0): + kx, _ky = _orbit(amplitude * on, 0.0, revolutions=3) + signed = distributed_friction_history(spec, kx, 0.0 * kx) + uniform = distributed_friction_history(spec, kx, 0.0 * kx, bound="uniform") + ratio = _last_cycle(signed.dissipation_J_per_m) / _last_cycle( + uniform.dissipation_J_per_m + ) + # Measured: 1.00009 and 0.99965 (inner armour, lam = 0.045). + assert ratio == pytest.approx(1.0, abs=1e-3) + assert abs(np.max(np.abs(uniform.balance_residual_J_per_m))) <= 1e-9 * abs( + uniform.dissipation_J_per_m[-1] + ) + default = distributed_friction_history(spec, kx, 0.0 * kx) + assert np.array_equal(default.stress_Pa, signed.stress_Pa) + result = compute_fatigue( + [inner], kx, 0.5 * kx[::-1], friction_model="auto", distributed_bound="uniform" + ) + assert "uniform bound without the capstan term" in result.provenance.method + + +# --------------------------------------------------------------------------- # +# documented pitch-mean offset of the direction-tied cap # +# --------------------------------------------------------------------------- # +@pytest.mark.analytical_sanity +def test_direction_tied_pitch_mean_offset_in_full_slip(inner): + spec = inner.spec + on = slip_onset_curvature(spec) + kx = np.linspace(0.0, 64.0 * on, 65) + stress = wire_slip_history(spec, kx, 0.0 * kx).stress_Pa[:, -1] + lam = spec.mu * abs(math.sin(spec.lay_angle_rad)) + x0 = lam * math.pi / 2.0 + width = 2.0 * math.pi * spec.r_helix_m / spec.n_wires + sigma0 = ( + spec.r_helix_m + * spec.contact_pressure_Pa + * width + * math.cos(spec.lay_angle_rad) + / (spec.A_wire_m2 * math.sin(spec.lay_angle_rad) ** 2) + ) + offset = sigma0 * (math.sinh(x0) / x0 - 1.0) + # Wire sampling of the pitch and the stick zone (O(kappa_on / kappa)). + assert float(np.mean(stress)) == pytest.approx(offset, rel=3e-2) + # Leading order lam pi / 12 of the peak tensile friction stress. + peak = sigma0 * math.expm1(x0) + assert offset / peak == pytest.approx(lam * math.pi / 12.0, rel=lam) + # A uniform shift of every wire leaves the moment unchanged (round-off). + arm = np.cos(spec.phi_wires) + assert abs(float(np.mean(stress) * arm.sum())) < 1e-12 * float( + np.abs(stress * arm).sum() + ) diff --git a/validation/validation_report.md b/validation/validation_report.md index 7b8cb7c..0c70a6a 100644 --- a/validation/validation_report.md +++ b/validation/validation_report.md @@ -67,9 +67,9 @@ Every row is computed from published data or closed-form references in this repo ## Test taxonomy (full gate suite) -- analytical_sanity: `1151 passed, 3195 deselected` -- independent_method: `70 passed, 4276 deselected` -- full_scale: `31 passed, 4315 deselected` +- analytical_sanity: `1153 passed, 3210 deselected` +- independent_method: `76 passed, 4287 deselected` +- full_scale: `31 passed, 4332 deselected` Run `pytest -m ` to reproduce each group. From acd493d517b457b77030058e7fe7e724beea3347 Mon Sep 17 00:00:00 2001 From: Jae Hoon Seo Date: Mon, 16 Nov 2026 21:18:03 +0900 Subject: [PATCH 2/2] fix: the default-change warning says auto takes the distributed model on every layer it covers Signed-off-by: Jae Hoon Seo --- src/cablexsec/analysis/fatigue.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/cablexsec/analysis/fatigue.py b/src/cablexsec/analysis/fatigue.py index 8234d2d..1de82df 100644 --- a/src/cablexsec/analysis/fatigue.py +++ b/src/cablexsec/analysis/fatigue.py @@ -255,7 +255,8 @@ def _warn_default_direction_tied(out_of_plane: float, stacklevel: int) -> None: "in the next release; pass friction_model explicitly to keep the current " "behaviour. This curvature path is not planar (out-of-plane ratio " f"{out_of_plane:.3g} > {PLANAR_PATH_TOLERANCE:g}), so 'auto' would " - "solve the distributed helix model here. The direction-tied cap turns " + "solve the distributed helix model on every layer it covers. The " + "direction-tied cap turns " f"with the bending direction: {DIRECTION_TIED_ROTATION_BIAS}.", DirectionTiedFrictionWarning, stacklevel=stacklevel + 1,