diff --git a/CHANGELOG.md b/CHANGELOG.md index b682b8a..01507c7 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -10,6 +10,22 @@ All notable changes to CableXSec are recorded in this file. The format follows ### Added +- Torsional wire stress in the fatigue path. `compute_fatigue` and `compute_conductor_fatigue` + take `twist_rate_per_m`, the material twist rate of the cable [rad/m], positive in the sense + that tightens a right-hand (Z) lay. Every armour wire gains the axial stress of its helix strain + `s r sin(a) cos(a) tau` (Knapp 1981, Eqs. 2 and 11, fixed radii). With a tension history the + tension is held, so the strain also changes by `-K_et tau / K_ee`. Every conductor ring wire + gains the strain of the laid core and of the ring twisting with the cable. The reader forms the + rate from CableDyn's `TwistN` channels: `CableDynSectionHistory.twist_rate_per_m` is the + element rate inside an element and the mean of the two element rates on a deck node, the + definition CableDyn uses for `TorqN`. `twist_stress_coefficient` gives the stress per unit + rate. The sea-state batch applies it with `SeaStateBatchOptions(twist_stress=True)`. + `TorsionalStressWarning` is issued in two cases: CableDyn writes twist or torque at a section + but not the `Twist` channels its rate needs (the warning names them), or a batch omits a + history's twist rate. `section_channels` lists the extra node. Without the input, every result + is unchanged, bit for bit. Verification row TQ-FT; no measured wire strain under torsion is in + the validation set yet. + - `validation/scripts/benchmark_throughput.py`: one-core throughput of sea-state fatigue on the 66 kV template (direction-tied and distributed models, every wire or 12 positions, 4 or 32 fibres), the damage differences from an earlier build, and the sea-state batch time diff --git a/VALIDATION.md b/VALIDATION.md index de168d4..6e48556 100644 --- a/VALIDATION.md +++ b/VALIDATION.md @@ -37,6 +37,7 @@ afterwards: a comparison that misses its target is reported as failed. | **CF** | Laid-core friction limits | closed forms, rotation equivariance | ≤1.0e-4 | per check | Pass | | **FR** | Fretting regime: Mindlin energy, Fouvry transition, Cattaneo strip | closed forms, numerical Masing loop | ≤7.8e-12 | <1e-9 to <1e-12 | Pass | | **TQ** | Torque constant of a strand; coupled section; mirror lay | Feyrer, Example 2.8; Knapp (1981) | −0.11 %; −1.3e-6; 0 | ±0.2 %; <1e-4; <1e-9 | 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 | | **M-rec, M-rec-3core** | Assembled per-wire moment against the section engine | cross-engine | 0.000 % | <2 % | Pass | diff --git a/doc/benchmarks.md b/doc/benchmarks.md index 1619b4e..ac1f77a 100644 --- a/doc/benchmarks.md +++ b/doc/benchmarks.md @@ -2584,7 +2584,7 @@ and 0.092 against 0.035/0.044 and 0.054/0.063. over-prediction comes from what the one-way anchored chain does with it (SV11-SPLIT), not from the profile. -## Torque balance and twist under tension (gap 3.5: TQ, TQ-KL, TQ-UJ) +## Torque balance and twist under tension (gap 3.5: TQ, TQ-KL, TQ-UJ, TQ-FT) Script `validation/scripts/check_torque_balance.py`, tests `tests/test_torque_balance.py`, rows TQ, TQ-KL and TQ-UJ of the scorecard. `torque_balance` solves the coupled radial @@ -2604,6 +2604,18 @@ moments (Costello 1997, Example 3.1: −5% torque for a seven-wire strand). | TQ5 | A | Mirror lay: every lay direction reversed (armour and laid cores) on the 1×37 rope and the 66 kV template | < 1e-9 relative | torque and twist reverse, wire stresses and balance ratio unchanged (0 and below 1e-9) | PASS | | TQ6 | I | `fixed_radius` against `xsec_stiffness` (`EA_N`, `EA_torsion_coupling`, `GJ_Nm2`); solved 66 kV template against the fixed-radius torque coefficient | identical; < 1% | identical; 1.5026 against 1.5251 mm (−1.5%); EA 607 against 638 MN | FAIL (since the insulation screens carry load in both models; −0.5% when the fixed-radius model left them out) | | TQ7 | I | Design round trip on the 66 kV template: zero torque coefficient at the returned lay angle; free twist and stress redistribution then vanish | < 1e-9 m; < 1e-12; < 1e-3 Pa | 1.3e-13 m; below 1e-12; below 1e-3 Pa | PASS | +| TQ8 (TQ-FT) | A, I | Twist-rate wire stress of the fatigue path, `eps cos^2(a) + s R tau sin(a) cos(a)` (Knapp 1981, Eq. 11 with a radially rigid core, the twist strain of Eq. 2), tension held, `eps = (T - K_et tau)/K_ee`: (a) 66 kV template armour, 60 kN and a twist history without bending, recovered stress and per-wire damage against the closed form from the schema data; (b) Feyrer 1×37 rope, whose helical layers alone carry `K_et` and `K_tt`: torque `sum s n A sigma R sin(a)` and tension of the fatigue wire stresses at (10 kN, 2e-3 rad/m) against `K_et eps + K_tt tau` and `T`; (c) every lay reversed and the twist negated, with biaxial bending; (d) zero twist against no twist input, armour fibres and conductor azimuths | < 1e-12; < 1e-12; < 1e-12; 0 | (a) 3.6e-16 and 4.5e-15; (b) 2.2e-16 and 0; (c) 0; (d) 0 | PASS | + +TQ8 was registered before the implementation was run. It checks the +arithmetic and the consistency with the stiffness matrix, not a measurement: +no TQ row measures wire strain under torsion. Utting and Jones (1987, Part II, +Figs 5 and 6) give mean helical-wire surface strains against the torsional end +restraint, in figures only and including the wire bending, which the fatigue +term leaves out. They are a candidate row for later. Against the solved radial +section of the 66 kV template (`solve_cable_radial_state`, 1e-3 rad/m +prescribed at 0 and 50 kN, tension held), the fixed-radius twist stress is +within 6 % on the inner armour (−3.88 against −3.66 and −3.89 MPa) and within +1 % on the outer armour (+2.62 against +2.64 and +2.61 MPa). The excess over the Machida–Durelli theory is the omitted bending and twisting moments of the wires, which scale with `(d / 2r)²` (0.23 for these diff --git a/doc/global_local_guide.md b/doc/global_local_guide.md index 004c822..7d58a9b 100644 --- a/doc/global_local_guide.md +++ b/doc/global_local_guide.md @@ -138,8 +138,9 @@ torsion); where a later release changed a channel, the item says so. returns, per section at unstretched arc length `s` from End A: `time_s`, `effective_tension_N`, `rotation_curvature_x_1_m`, `rotation_curvature_y_1_m`, `curvature_norm_1_m`, `elevation_m`, -`external_pressure_Pa`, `torque_Nm`, `twist_rad`, the labels of the frame, -curvature source and tension source, and a provenance record. The read also +`external_pressure_Pa`, `torque_Nm`, `twist_rad`, `twist_rate_per_m` +(Section 2.2), the labels of the frame, curvature source and tension source, +and a provenance record. The read also returns the digests of every file read and the consistency checks. **Curvature vector.** `curvature_source="tangent"` splines the tangents of @@ -296,8 +297,9 @@ nodes cannot be placed: the positions are read at the deck nodes, channels the tangent source needs for the section frame: `Dec`/`Azi` on the window, `Ten`, `Curv` and `p{x,y,z}` at the bracketing nodes, and `Twist`/`Torq` on a line CableDyn solves in torsion (`torsion_solved`; -CableDyn refuses them on any other line). The arc frame also needs the -line's `p` flag. Adding `t` gives the element tensions. +CableDyn refuses them on any other line), with `Twist` also at the node before +a section that lies on a deck node (its twist rate, Section 2.2). The arc frame +also needs the line's `p` flag. Adding `t` gives the element tensions. ### 2.1 CableDyn 0.4.0 signed curvature components @@ -341,6 +343,68 @@ recorded where written). A station given by a rounded arc length a few micrometres off its node needs the next node's channels too; the error names the node and its arc length. +### 2.2 Twist rate and the torsional wire stress + +A twist of the cable stresses its helical wires, not only the frame. With plane +sections and fixed layer radii a wire of lay angle `a`, helix radius `R` and lay +sign `s` (+1 right hand, Z; −1 left hand, S) strains by + +```text +eps_w = eps cos^2(a) + s R tau sin(a) cos(a) +``` + +under the cable strain `eps` and the twist rate `tau` (Knapp 1981, Eq. 11 with a +radially rigid core and the twist strain of its Eq. 2). `compute_fatigue(..., +twist_rate_per_m=tau)` adds this stress to every armour wire, the same for every +wire of a layer: the bending slip and the friction stress are unchanged, on +every friction model. With `tension_N` the tension is held, so the strain also +changes by `−K_et tau / K_ee` with the fixed-radius coupling `K_et` and +`EA_fixed = K_ee` of `compute_stiffness`. This is the section law `T = EA eps + +K tau`, `M = GJ tau + K eps` that CableDyn solves with `GJ|K`, so a deck +whose `EA`, `GJ` and `K` are the section's `K_ee`, `K_tt` and `K_et` gives +CableXSec the strain CableDyn has. `compute_conductor_fatigue(..., +twist_rate_per_m=tau)` adds the twist strain of the laid core, `(r_c tan(b) − +K_et/K_ee) tau`, to the conductor axis, and the twist of the ring wires about it. + +**Input: the twist rate, not the torque.** The reader forms +`twist_rate_per_m` from `TwistN` alone. CableDyn's element twist is +`Twist_{k+1} − Twist_k = M L_0/GJ − (K/GJ)(l − L_0)`, the material twist of +the element, so `(Twist_{k+1} − Twist_k)/L_0` is its kinematic twist rate per +unstretched length. A section inside an element takes that element's rate, from +the two `Twist` channels the frame needs already. A section on a deck node takes +the mean of its two elements' rates, the definition CableDyn uses for +`TorqN`, and needs `Twist` at the node and at both neighbours (one +element at a line end). The torque is not converted: + +- it includes the Kelvin–Voigt torsional damping (`GJ|K|Bt`); +- under a bend stiffener it is the section torque, not the cable's share; +- its conversion would need a torsional law, while the twist rate is the global + model's own kinematics, like the curvature. + +`Torq` is a consistency check instead: `Torq = GJ tau + K eps` with `eps = +(Ten − K tau)/EA`, to the print precision of the `Twist` channels. + +**Signs.** CableDyn's `Twist` is right-handed about the End A → End B +tangent, so `tau > 0` tightens a right-hand lay: CableXSec's sign (Section 12 +of the local analysis guide), with no flip. A right-hand (Z) armour layer takes +tension and a left-hand (S) layer compression under a positive twist rate. + +**Deck outputs for the torsional stress.** At every station on deck node `J` +write `TwistN`, `TwistN` and `TwistN` (the end node and +its neighbour at a line end), and `TorqN` for the check. Where CableDyn +writes twist or torque at a section but not these channels, the reader warns +(`TorsionalStressWarning`, naming them) and `twist_rate_per_m` is `None`. +`checks["twist_rate"]` records the elements used for each section. + +**Limits.** The term is the linear fixed-radius helix strain. It leaves out +the radial contraction of the layers (on the 66 kV template the solved radial +section gives the same twist stress within 6 %), the opening of a contact +under a twist that unloads a layer, the twist's change of the interlayer +contact pressure (the friction caps follow the tension), and the bending and +twisting of the individual wires. No measured wire strain under torsion is in +the validation set; row TQ-FT verifies the arithmetic and the consistency with +`K_et` and `K_tt` ([benchmarks.md](benchmarks.md)). + ## 3. Sea-state batch ```python @@ -410,6 +474,11 @@ result.sections["sag"].long_term.annual_damage, result.sections["sag"].life_year the wider tolerance; a 10-column row gives no `GJ` and is not compared. A mismatch stops the batch unless `allow_property_mismatch=True` is declared, and the comparison is written to the manifest either way. +- Torsional wire stress: `twist_stress=True` passes each section's + `twist_rate_per_m` (Section 2.2) to `compute_fatigue`; on a line CableDyn + solves in torsion a section without it is refused. With the default `False` + a section whose history has a twist rate warns (`TorsionalStressWarning`) + that the stress is omitted, and the result is that of earlier releases. - Workers: `workers` processes, one numerical thread each, spawned, at most one per run; there is no upper limit, so choose the count for the machine (the runs are independent and the batch scales with the worker count while @@ -458,6 +527,7 @@ Paths are relative to the JSON file; unknown keys are rejected. | Rigid heading rotation of the configuration | components unchanged (1e-9) | | Bending plane turning about the hang-off tangent by `φ(t)` (arc frame) | `κ(−sin φ, cos φ)` within 5e-6 1/m | | Material twist of a restrained line | axes turned by the `Twist` channel; components `κ(sin φ, cos φ)` | +| Twist rate from `Twist` channels of two element rates (1e-3 and 3e-3 rad/m) | inside each element its rate, on the node their mean (1e-12); missing neighbour channels named | | Tangent placement on a non-uniform mesh (0.2 m then 0.3 m elements): node tangents of a finite-EI line; chords of an `EI = 0` line and, with `tangent_placement="chord"`, of a finite-EI line | curvature within 1e-4 of `κ` at End A, the mesh junction and End B; node tangents read as chords give more than 1.5 `κ` at End A | | Tension between element mid-arcs, hydrostatic pressure, `T_e − p_o A_o` | exact for a linear field; elevation within 1e-7 m | | Round trip through the time-history CSV path: section history written as a CSV export (`x curvature`, `y curvature`, `Wall tension`) and read with `read_time_history_csv` | identical `LoadCaseSeries` (1e-12) and identical fixed-fibre damage | diff --git a/doc/user_guide.md b/doc/user_guide.md index 4a89b93..9049349 100644 --- a/doc/user_guide.md +++ b/doc/user_guide.md @@ -105,7 +105,10 @@ for screening. `cx.fatigue_from_series`): the damage of every armour wire at fixed fibres round the wire, and of the conductors and metallic sheaths with fatigue data (`cx.compute_conductor_fatigue`, `cx.compute_shell_fatigue`), with the - {term}`critical wire and fibre`. + {term}`critical wire and fibre`. A twist-rate history (`twist_rate_per_m`, + rad/m, positive tightening a right-hand lay) adds the torsional stress of + the armour and conductor wires; a CableDyn section history carries it as + `twist_rate_per_m` ([global–local guide](global_local_guide.md), Section 2.2). - **{term}`Long-term fatigue `** (`cx.compute_long_term_fatigue`): the damage over a {term}`scatter diagram`, one `FatigueLoadCase` per {term}`sea state` with its probability. - **Armour fretting**, **core screen fatigue** and **tape fatigue** of a load diff --git a/src/cablexsec/__init__.py b/src/cablexsec/__init__.py index 9409f40..9d95b4f 100644 --- a/src/cablexsec/__init__.py +++ b/src/cablexsec/__init__.py @@ -316,6 +316,7 @@ DirectionTiedFrictionWarning, FrictionModelFallbackWarning, MissingClampingStateWarning, + TorsionalStressWarning, UnmodelledPolymerSofteningWarning, ) @@ -589,6 +590,7 @@ "UnevaluatedFatigueCurveWarning", "UnvalidatedModelWarning", "MissingClampingStateWarning", + "TorsionalStressWarning", "UnmodelledPolymerSofteningWarning", "CableXSecError", "CableInputError", diff --git a/src/cablexsec/analysis/conductor_fatigue.py b/src/cablexsec/analysis/conductor_fatigue.py index 58257aa..b2afc8b 100644 --- a/src/cablexsec/analysis/conductor_fatigue.py +++ b/src/cablexsec/analysis/conductor_fatigue.py @@ -95,6 +95,7 @@ from __future__ import annotations +import dataclasses import math import warnings from collections.abc import Sequence @@ -138,6 +139,7 @@ ConductorRing, PressureTransmission, StrandSlipParameters, + StrandSlipResult, conductor_axial_stiffness, conductor_ring_parameters, interface_line_loads, @@ -152,6 +154,7 @@ "ConductorFatigueResult", "TrellisContact", "assess_conductor_fatigue", + "ring_twist_strain_per_rate", "trellis_contact", "trellis_force_ratio", ] @@ -557,6 +560,38 @@ def _trellis_critical_distance( return best, best_e, best_x +def ring_twist_strain_per_rate( + ring: ConductorRing, axis_strain_per_twist_m: float +) -> float: + """Axial wire strain of a ring per unit twist rate [m] ([Knapp1981] Eq. 11). + + ``cos^2(a) e_tau + s r sin(a) cos(a)``: the conductor axis strain + ``e_tau tau`` resolved along the wire and the helix strain of the ring + twisting with the conductor (fixed radii, radially rigid support). + """ + a = ring.lay_angle_rad + c = math.cos(a) + return ( + c * c * axis_strain_per_twist_m + + ring.lay_sign * ring.r_helix_m * math.sin(a) * c + ) + + +def _with_twist_strain( + ring: ConductorRing, + result: StrandSlipResult, + twist: FloatArray, + axis_strain_per_twist_m: float, +) -> StrandSlipResult: + """Add the uniform twist strain of a ring to its axial and total strain.""" + strain = ring_twist_strain_per_rate(ring, axis_strain_per_twist_m) * twist + return dataclasses.replace( + result, + axial_strain=result.axial_strain + strain[None, :], + strain=result.strain + strain[None, :], + ) + + def assess_conductor_fatigue( rings: Sequence[ConductorRing], E_Pa: float, @@ -584,6 +619,8 @@ def assess_conductor_fatigue( mean_stress: MeanStressSpec | None = None, scf: ComponentSCF | None = None, critical_distance: CriticalDistanceSpec | None = None, + twist_rate_per_m: ArrayLike | None = None, + axis_strain_per_twist_m: float | None = None, ) -> ConductorFatigueResult: """Bulk and trellis-fretting damage of every ring of a stranded conductor. @@ -648,6 +685,19 @@ def assess_conductor_fatigue( mean-stress correction against ``sn_bulk``. The ring damage is then the larger of the bulk and the trellis value (the trellis value already contains the bulk stress). Exclusive with ``swt_const``. + twist_rate_per_m : array_like or None, optional + Twist rate of the conductor [rad/m], positive in the sense that + tightens a right-hand lay; it adds the uniform axial strain + ``cos^2(a) e_tau tau + s r sin(a) cos(a) tau`` to every wire of a + ring ([Knapp1981] Eqs. 2 and 11, fixed radii), with ``e_tau = + axis_strain_per_twist_m`` the strain of the conductor axis per unit + twist rate (required with the twist rate). It does not change the + ring contact. ``None`` (default) leaves the result unchanged, bit for + bit. + axis_strain_per_twist_m : float or None, optional + Axial strain of the conductor axis per unit twist rate [m]: for a + laid core of a cable, ``r_c tan(b) - K_et/K_ee`` with the tension held + (:func:`cablexsec.compute_conductor_fatigue`). Returns ------- @@ -667,6 +717,23 @@ def assess_conductor_fatigue( if reference_tension_N is None: peak = 0.0 if tension is None else float(np.max(np.abs(tension))) reference_tension_N = peak if peak > 0 else 1.0 + twist = None + if twist_rate_per_m is not None: + twist = np.asarray(twist_rate_per_m, dtype=np.float64) + if twist.shape != kx.shape or not np.isfinite(twist).all(): + raise CableInputError( + "twist_rate_per_m must be finite and match the curvature histories" + ) + if axis_strain_per_twist_m is None or not math.isfinite( + axis_strain_per_twist_m + ): + raise CableInputError( + "twist_rate_per_m requires a finite axis_strain_per_twist_m" + ) + elif axis_strain_per_twist_m is not None: + raise CableInputError( + "axis_strain_per_twist_m is used only with twist_rate_per_m" + ) if swt_const is not None: warnings.warn( "conductor trellis fretting (per-slip-cycle SWT) is not validated: " @@ -724,6 +791,9 @@ def assess_conductor_fatigue( cd_face = np.full(n_rings, np.nan) for i, (ring, params) in enumerate(zip(rings, parameters, strict=True)): result = strand_slip_strain(params, kx, ky, tension, theta_rad=theta) + if twist is not None: + assert axis_strain_per_twist_m is not None # checked above + result = _with_twist_strain(ring, result, twist, axis_strain_per_twist_m) # Compaction indentations raise the stress of the whole wire section # (axial and bending parts alike) by the ring's factor (gap CF3). compaction = ring.compaction_scf diff --git a/src/cablexsec/analysis/fatigue.py b/src/cablexsec/analysis/fatigue.py index e48fe22..e74e8c0 100644 --- a/src/cablexsec/analysis/fatigue.py +++ b/src/cablexsec/analysis/fatigue.py @@ -179,6 +179,7 @@ "miner_damage", "rainflow_cycles", "select_wires", + "twist_stress_coefficient", ] FloatArray = NDArray[np.float64] @@ -394,6 +395,84 @@ def _validate_tension( raise CableInputError("tension_N requires finite positive EA_full_N") +def twist_stress_coefficient( + layer: FatigueLayer, + *, + axial_twist_coupling_Nm: float | None = None, + EA_full_N: float | None = None, +) -> float: + r"""Axial wire stress per unit cable twist rate [Pa per rad/m]. + + The linear wire strain of a helical layer under the cable strain + ``epsilon`` and the twist rate ``tau`` with plane sections and fixed + layer radii is ``cos^2(a) epsilon + s r sin(a) cos(a) tau`` ([Knapp1981] + Eq. 11 with a radially rigid core, ``theta = 0``, and the twist strain + ``gamma = r tau / tan(a)`` of its Eq. 2), with the lay sign ``s`` + (``layer.lay_hand``: +1 right hand, -1 left hand). A positive ``tau`` + tightens a right-hand lay. + + Without ``axial_twist_coupling_Nm`` the cable strain is held (the + prescribed-strain route) and the coefficient is ``E s r sin(a) cos(a)``. + With the coupling ``K_et`` of the section law ``T = K_ee epsilon + K_et + tau`` and ``EA_full_N = K_ee``, the tension is held instead, so the twist + also changes the strain by ``-K_et tau / K_ee``: the coefficient is + ``E (s r sin(a) cos(a) - cos^2(a) K_et / K_ee)``. ``E`` is the axial + modulus of the tension stress (``E_eff_axial_Pa``, else the wire modulus). + """ + spec = layer.spec + a = abs(spec.lay_angle_rad) + e_ax = layer.E_eff_axial_Pa or spec.E_wire_Pa + per_rate = layer.lay_hand * spec.r_helix_m * math.sin(a) * math.cos(a) + if axial_twist_coupling_Nm is not None: + if not math.isfinite(axial_twist_coupling_Nm): + raise CableInputError("axial_twist_coupling_Nm must be finite") + if EA_full_N is None or not math.isfinite(EA_full_N) or EA_full_N <= 0: + raise CableInputError( + "axial_twist_coupling_Nm requires finite positive EA_full_N" + ) + per_rate -= math.cos(a) ** 2 * axial_twist_coupling_Nm / EA_full_N + return e_ax * per_rate + + +def _validate_twist( + twist_rate_per_m: FloatArray | None, + axial_twist_coupling_Nm: float | None, + shape: tuple[int, ...], + *, + tension_given: bool, + strain_given: bool, + normal_given: bool, +) -> FloatArray | None: + """Check the twist-rate input against the axial loading route.""" + if twist_rate_per_m is None: + if axial_twist_coupling_Nm is not None: + raise CableInputError( + "axial_twist_coupling_Nm is used only with twist_rate_per_m" + ) + return None + twist = real_array(twist_rate_per_m, "twist_rate_per_m") + if twist.shape != shape or not np.isfinite(twist).all(): + raise CableInputError( + "twist_rate_per_m must be finite and match the curvature histories" + ) + if normal_given: + raise CableInputError( + "a solved normal stress carries its own twist; supply the twist rate " + "with tension or prescribed axial strain instead" + ) + if strain_given and axial_twist_coupling_Nm is not None: + raise CableInputError( + "with a prescribed axial strain the twist does not change the strain; " + "omit axial_twist_coupling_Nm" + ) + if tension_given and axial_twist_coupling_Nm is None: + raise CableInputError( + "twist_rate_per_m with tension_N requires axial_twist_coupling_Nm " + "(K_et of the section; 0 for an uncoupled section)" + ) + return twist + + def rainflow_cycles( sigma_series_Pa: FloatArray, ) -> Iterator[tuple[float, float, float, int, int]]: @@ -593,9 +672,12 @@ class FatigueLayer: the geodesic slip. ``None`` with ``eta > 0`` selects the legacy map and issues ``TransverseMapWarning``. lay_hand : int, optional - ``+1`` right-hand lay (default), ``-1`` left-hand lay; used only by the + ``+1`` right-hand lay (default), ``-1`` left-hand lay; used by the termination (clamp) correction to set the sense in which a wire turns - along the cable. + along the cable, and for the sign of the twist-rate stress + (:func:`twist_stress_coefficient`). Layers built from a cable + (:func:`~cablexsec.cable_adapters.cable_to_fatigue_layers`) take it + from the layer's ``lay_direction``. mean_stress : MeanStressSpec or None, optional Mean-stress correction of the bulk cycles (:mod:`cablexsec.materials.mean_stress`); ``None`` (default) counts @@ -816,6 +898,8 @@ def _wire_stress_parts( time_s: FloatArray | None = None, distributed_bound: DistributedBound = "signed", wires: IntArray | None = None, + twist_rate_per_m: FloatArray | None = None, + axial_twist_coupling_Nm: float | None = None, ) -> _StressParts: """Friction, axial and thermal parts of ``sigma_total(phi_k, t)`` [Pa]. @@ -840,8 +924,19 @@ def _wire_stress_parts( A solved normal_stress_Pa history instead retains the layer's extension, twist, pressure and thermal response, without separate axial/thermal terms. Optional moduli carry material and shear-support changes between steps. + ``twist_rate_per_m`` adds the axial stress of the cable twist rate, + ``twist_stress_coefficient(layer, ...) * tau``, to ``sigma_A`` (the same + for every wire of the layer). """ spec = layer.spec + twist = _validate_twist( + twist_rate_per_m, + axial_twist_coupling_Nm, + kappa_x.shape, + tension_given=tension_N is not None, + strain_given=axial_strain is not None, + normal_given=normal_stress_Pa is not None, + ) if normal_stress_Pa is not None and any( value is not None for value in (tension_N, axial_strain, thermal_stress_Pa) ): @@ -972,6 +1067,17 @@ def _wire_stress_parts( assert EA_full_N is not None # validated before stress recovery e_ax = layer.E_eff_axial_Pa or spec.E_wire_Pa sigma_A_t += e_ax * math.cos(a) ** 2 * np.asarray(tension_N) / EA_full_N + if twist is not None: + # Twist-rate strain of the helix ([Knapp1981] Eqs. 2, 11): uniform + # over the layer, so it adds to sigma_A and leaves the slip unchanged. + sigma_A_t += ( + twist_stress_coefficient( + layer, + axial_twist_coupling_Nm=axial_twist_coupling_Nm, + EA_full_N=EA_full_N, + ) + * twist + ) sigma_T_t = np.zeros(n_steps, dtype=np.float64) if thermal_stress_Pa is not None: @@ -1129,6 +1235,8 @@ def wire_stress_field( time_s: FloatArray | None = None, distributed_bound: DistributedBound = "signed", wires: IntArray | None = None, + twist_rate_per_m: FloatArray | None = None, + axial_twist_coupling_Nm: float | None = None, ) -> WireStressField: """Recover the shared stress field once, retaining all preceding slip history. @@ -1189,6 +1297,12 @@ def wire_stress_field( termination clamp increment is rate independent and is refused with a non-neutral law. ``None`` or a neutral law leaves the field unchanged, bit for bit. + + ``twist_rate_per_m`` [rad/m] adds the axial stress of the cable twist + rate (positive tightens a right-hand lay) to every wire of the layer, + :func:`twist_stress_coefficient` times the rate; with ``tension_N`` it + needs the section coupling ``axial_twist_coupling_Nm``. ``None`` leaves + the field unchanged, bit for bit. """ kx, ky = real_array(kappa_x, "kappa_x"), real_array(kappa_y, "kappa_y") _check_distributed_bound(distributed_bound) @@ -1278,6 +1392,8 @@ def wire_stress_field( time_s=time_s, distributed_bound=distributed_bound, wires=wires, + twist_rate_per_m=twist_rate_per_m, + axial_twist_coupling_Nm=axial_twist_coupling_Nm, ) spec = layer.spec increment = None @@ -1599,6 +1715,8 @@ def compute_fatigue( friction_law: FrictionLaw | None = None, time_s: FloatArray | None = None, wire_positions: WirePositions | None = None, + twist_rate_per_m: FloatArray | None = None, + axial_twist_coupling_Nm: float | None = None, ) -> FatigueResult: """Run the per-wire fatigue pipeline over a curvature/tension history. @@ -1727,6 +1845,22 @@ def compute_fatigue( time_s : numpy.ndarray, optional Sample times [s] of the history, required by a law that depends on time (slip rate or a finite healing time). + twist_rate_per_m : numpy.ndarray or None, optional + Material twist rate of the cable [rad/m], positive in the sense that + tightens a right-hand (Z) lay, which is a twist increasing + right-handed about the cable tangent along the arc length. Each wire + gains the axial stress ``twist_stress_coefficient(layer, ...) * tau`` + of the helix strain ``s r sin(a) cos(a) tau`` ([Knapp1981] Eqs. 2, + 11), the same for every wire of a layer, so the bending slip is + unchanged. With ``tension_N`` the tension is held and + ``axial_twist_coupling_Nm`` (``K_et`` of the section, as + :func:`cablexsec.compute_stiffness` reports it) is required; with + ``axial_strain`` the strain is held and the coupling is refused. + Refused with ``normal_stress_Pa``. ``None`` (default) gives the + earlier result, bit for bit. + axial_twist_coupling_Nm : float or None, optional + Axial-twist coupling ``K_et`` [N m] of the section law + ``T = EA_full epsilon + K_et tau``; only with ``twist_rate_per_m``. Returns ------- @@ -1815,6 +1949,14 @@ def compute_fatigue( "supply solved normal stress or separate axial/thermal loads" ) _validate_tension(tension_N, EA_full_N, kx.shape) + twist = _validate_twist( + twist_rate_per_m, + axial_twist_coupling_Nm, + kx.shape, + tension_given=tension_N is not None, + strain_given=axial_strain is not None, + normal_given=normal_stress_Pa is not None, + ) layer_names = {layer.name for layer in layers} if len(layer_names) != len(layers): raise CableInputError("fatigue layer names must be unique") @@ -1969,6 +2111,8 @@ def compute_fatigue( friction_law=friction_law, time_s=time_s, wires=selected[name], + twist_rate_per_m=twist, + axial_twist_coupling_Nm=axial_twist_coupling_Nm, ) if field.termination is not None and layer_termination is not None: clamp_summary[name] = _clamp_summary(layer_termination, field.termination) @@ -2304,6 +2448,8 @@ def compute_fatigue( "and are not counted", ), ) + if twist is not None: + prov = _twist_provenance(prov, axial_twist_coupling_Nm) return FatigueResult( D_bulk_per_wire=d_bulk, D_fretting_per_wire=d_fret, @@ -2335,6 +2481,33 @@ def compute_fatigue( ) +#: Limitations of the twist-rate stress, recorded whenever it is applied. +TWIST_LIMITATIONS = ( + "twist-rate stress: linear helix strain with plane sections and fixed layer " + "radii (Knapp 1981 Eq. 11 with a radially rigid core); radial contraction, " + "contact opening under a twist that unloads a layer and the bending and " + "twisting moments of the individual wires are not included", + "twist-rate stress: the twist does not change the interlayer contact " + "pressure, so the friction caps follow the tension alone", +) + + +def _twist_provenance(prov: Provenance, coupling: float | None) -> Provenance: + """Record the twist-rate stress of the wires.""" + held = ( + f"tension held, coupling K_et = {coupling:.6g} N m" + if coupling is not None + else "axial strain held" + ) + return Provenance( + method=prov.method + + f"; twist-rate wire stress s r sin(a) cos(a) tau in sigma_A ({held})", + citations=(*prov.citations, "[Knapp1981] Eqs. 2, 11"), + gates=(*prov.gates, "tests/test_fatigue_torsion.py"), + limitations=(*prov.limitations, *TWIST_LIMITATIONS), + ) + + def _sn_option_provenance(prov: Provenance, layers: list[FatigueLayer]) -> Provenance: """Record user S-N curves, mean-stress corrections and component SCFs.""" parts: list[str] = [] diff --git a/src/cablexsec/analysis/sea_state_batch.py b/src/cablexsec/analysis/sea_state_batch.py index 9452439..07a4016 100644 --- a/src/cablexsec/analysis/sea_state_batch.py +++ b/src/cablexsec/analysis/sea_state_batch.py @@ -107,6 +107,7 @@ read_cabledyn_deck, read_cabledyn_sections, ) +from cablexsec.provenance import TorsionalStressWarning FloatArray = NDArray[np.float64] TensionBasis = Literal["auto", "true", "effective"] @@ -239,6 +240,14 @@ class SeaStateBatchOptions: ``K_tt`` leaves out the components' own torsion and the radial relaxation of the layers, which move a section's torsional stiffness by tens of percent either way, hence the wider default. + + ``twist_stress=True`` passes each section's twist rate + (:attr:`~cablexsec.io.cabledyn.CableDynSectionHistory.twist_rate_per_m`) + to :func:`cablexsec.compute_fatigue`, the torsional wire stress; on a + line CableDyn solves in torsion a section without it is refused. With the + default ``False`` a section whose history has a twist rate warns + (:class:`~cablexsec.provenance.TorsionalStressWarning`) that its + torsional stress is omitted, and the result is that of earlier releases. """ n_fibres: int = 32 @@ -266,6 +275,8 @@ class SeaStateBatchOptions: property_rtol: float = 0.05 torsion_rtol: float = 0.25 allow_property_mismatch: bool = False + #: Apply the torsional wire stress from the sections' twist rates. + twist_stress: bool = False workers: int = 1 chunk_rows: int = 4096 @@ -804,6 +815,24 @@ def _evaluate(task: _Task) -> dict[str, Any]: f"(tension basis {task.basis}); compute_fatigue needs a tensile " "force history" ) + twist = None + if history.twist_rate_per_m is not None: + if opts.twist_stress: + twist = history.twist_rate_per_m + else: + warnings.warn( + f"run {run.name!r}, section {section.name!r}: the history has " + "a twist rate, but twist_stress is False, so its fatigue omits " + "the torsional wire stress", + TorsionalStressWarning, + stacklevel=2, + ) + elif opts.twist_stress and read.checks["torsion"]["solved"]: + raise CableSchemaError( + f"run {run.name!r}, section {section.name!r}: twist_stress needs " + "the twist rate, which needs Twist channels at the section's " + "element(s) and, for a section on a deck node, at both neighbours" + ) fatigue: FatigueResult = compute_fatigue( task.cable, kx, @@ -822,6 +851,7 @@ def _evaluate(task: _Task) -> dict[str, Any]: sn_curves=section.sn_curves, mean_stress=section.mean_stress, scf=section.scf, + twist_rate_per_m=twist, ) fretting = None if section.fretting: @@ -1291,6 +1321,9 @@ def run_sea_state_batch( if opts.wire_positions is None: # Absent when unset, so that the digests of existing assessments stay. option_record.pop("wire_positions") + if not opts.twist_stress: + # Absent when unset, so that the digests of existing assessments stay. + option_record.pop("twist_stress") results: dict[str, SectionBatchResult] = {} histories: dict[str, dict[str, CableDynSectionHistory]] = {} for section in sections: diff --git a/src/cablexsec/api.py b/src/cablexsec/api.py index 5e3a578..b1a3282 100644 --- a/src/cablexsec/api.py +++ b/src/cablexsec/api.py @@ -182,6 +182,7 @@ resolve_core_friction, ) from cablexsec.mechanics.core_kinematics import CoreSlipState +from cablexsec.mechanics.core_lay import core_angle from cablexsec.mechanics.distributed_friction import DEFAULT_MAX_INCREMENT from cablexsec.mechanics.friction_law import ( FrictionLaw, @@ -1772,6 +1773,7 @@ def compute_conductor_fatigue( sn_curve: str | SNcurve | None = None, mean_stress: MeanStressOption | None = "swt", scf: ComponentSCF | None = None, + twist_rate_per_m: FloatArray | None = None, ) -> ConductorFatigueResult: r"""Strand-slip fatigue of a resolved stranded conductor. @@ -1862,6 +1864,17 @@ def compute_conductor_fatigue( scf : ComponentSCF, optional Factors on the axial part (axial factors) and on the stick-slip bending strain of the operator (friction factors), mean and dynamic. + twist_rate_per_m : numpy.ndarray or None, optional + Material twist rate of the cable [rad/m], positive in the sense that + tightens a right-hand lay (as in :func:`compute_fatigue`). The plane + cable section turns as a whole, so the conductor axis strain gains + ``(r_c tan(b) - K_et/K_ee) tau`` (the laid core at the radius + ``r_c`` and assembly angle ``b``, the core's term of the fixed-radius + coupling ``K_et``; tension held) and every ring wire the helix strain + ``cos^2(a) (...) + s r sin(a) cos(a) tau`` of the core twisting with + the cable (Knapp 1981, Eqs. 2 and 11). The twist does not change the + contact of the rings. ``None`` (default) gives the earlier result, + bit for bit. Returns ------- @@ -1895,6 +1908,14 @@ def compute_conductor_fatigue( if tension.shape != kx.shape: raise CableSchemaError("tension_N must match the curvature histories") require_finite(tension, "tension_N") + twist = None + if twist_rate_per_m is not None: + twist = real_array(twist_rate_per_m, "twist_rate_per_m") + if twist.shape != kx.shape: + raise CableSchemaError( + "twist_rate_per_m must match the curvature histories" + ) + require_finite(twist, "twist_rate_per_m") candidates = [ layer for layer in cable.layers @@ -2012,6 +2033,13 @@ def compute_conductor_fatigue( mean_stress=conductor_spec, scf=scf, critical_distance=cd_spec, + twist_rate_per_m=twist, + axis_strain_per_twist_m=( + None + if twist is None + else (layer.r_offset_m or 0.0) * math.tan(core_angle(cable, layer)) + - axial_torsional_matrix(cable).K_et / ea_fixed(cable) + ), ) if unevaluated: result = replace( @@ -2058,6 +2086,7 @@ def compute_fatigue( count_from_sample: int = 0, friction_law: FrictionLaw | None = None, wire_positions: WirePositions | None = None, + twist_rate_per_m: FloatArray | None = None, ) -> FatigueResult: r"""Per-wire fatigue of a cable over a biaxial curvature (and tension) history. @@ -2249,6 +2278,22 @@ def compute_fatigue( of every sample (both models). The crossing contact-life branches keep their rate-independent coefficient. ``None`` (default) or a neutral law gives the earlier result, bit for bit. + twist_rate_per_m : numpy.ndarray or None, optional + Material twist rate of the cable [rad/m], positive in the sense that + tightens a right-hand (Z) lay: CableDyn's right-handed twist about + the End A -> End B tangent per unit arc length, as + :class:`~cablexsec.io.cabledyn.CableDynSectionHistory` forms it + (``twist_rate_per_m``). Every armour wire gains the axial stress of + its helix strain ``s r sin(a) cos(a) tau`` (Knapp 1981, Eqs. 2 and 11, + fixed radii). With ``tension_N`` (or no axial input, zero tension) + the tension is held, so the strain also changes by ``-K_et tau / + K_ee`` with the fixed-radius coupling ``K_et`` and ``EA_fixed`` of + :func:`compute_stiffness`; with ``axial_strain`` the strain is held. + The twist does not change the interlayer contact pressure (the + friction caps follow the tension), and it is refused with + ``section_states`` and ``contact_model="qp"``, whose solved states + carry their own (zero) twist. ``None`` (default) gives the earlier + result, bit for bit. Returns ------- @@ -2257,7 +2302,7 @@ def compute_fatigue( References ---------- [ASTM E1049]; [Miner1945]; [DNVGL-RP-C203]; [Perier2009]; [Poon2022]; - [Poon2023]. + [Poon2023]; [Knapp1981] (twist-rate stress). Examples -------- @@ -2380,6 +2425,20 @@ def compute_fatigue( raise CableSchemaError("contact_tension_history_N must be >= 0.") for name, history in (thermal_stress_Pa or {}).items(): require_finite(history, f"thermal_stress_Pa[{name!r}]") + twist = None + if twist_rate_per_m is not None: + twist = real_array(twist_rate_per_m, "twist_rate_per_m") + require_finite(twist, "twist_rate_per_m") + if twist.shape != kx.shape: + raise CableSchemaError( + "twist_rate_per_m must match the curvature-history shape" + ) + if section_states is not None or contact_model == "qp": + raise CableSchemaError( + "twist_rate_per_m is not combined with section states or the qp " + "contact model: their solved normal states carry their own twist; " + "use the bounded or solved contact model with tension_N" + ) if section_states is not None: if any( @@ -2531,6 +2590,12 @@ def compute_fatigue( friction_law=law, time_s=law_time_s, wire_positions=wire_positions, + twist_rate_per_m=twist, + axial_twist_coupling_Nm=( + None + if twist is None or strain is not None + else axial_torsional_matrix(cable).K_et + ), ) if thermal_notes and result.provenance is not None: result = replace( diff --git a/src/cablexsec/io/cabledyn.py b/src/cablexsec/io/cabledyn.py index 259ee0b..cb261f9 100644 --- a/src/cablexsec/io/cabledyn.py +++ b/src/cablexsec/io/cabledyn.py @@ -172,6 +172,24 @@ ``rhoW`` and ``g``; wave dynamic pressure is not included. Torque and twist are taken from ``TorqN`` and ``TwistN`` when written. +The material twist rate ``twist_rate_per_m`` (the input of the torsional wire +stress, :func:`cablexsec.compute_fatigue` ``twist_rate_per_m``) is formed from +``TwistN`` alone, which is kinematic: CableDyn's element twist is +``Twist_{k+1} - Twist_k = M L_0/GJ - (K/GJ)(l - L_0)`` (CableDyn +``doc/outputs.rst``), so its rate per unstretched length is +``(Twist_{k+1} - Twist_k)/L_0``. A section inside an element takes that +element's rate (the two bracketing nodes); a section on a deck node takes the +mean of the rates of its two elements, as CableDyn's ``TorqN`` is the +mean of their torques, which needs ``Twist`` at the node and at both +neighbours (the end element alone at a line end). It is positive in the sense +that tightens a right-hand lay, CableXSec's sign, which is CableDyn's +right-handed twist about the End A -> End B tangent. Where ``Twist`` or +``Torq`` channels are written at a section but the rate cannot be formed, +:class:`~cablexsec.provenance.TorsionalStressWarning` names the channels to +add. Torque is not converted: it contains the torsional damping and, under a +bend stiffener, the sleeve's share, and its conversion would need a torsional +law where the twist rate is the global model's own kinematics. + Every required file, column and channel is checked by name and unit; a missing one raises :class:`~cablexsec.exceptions.CableSchemaError` naming it. """ @@ -183,6 +201,7 @@ import numbers import re import sys +import warnings from collections.abc import Generator, Mapping, Sequence from dataclasses import dataclass, field, replace from pathlib import Path @@ -198,7 +217,7 @@ rotation_to_strain_curvature, true_tension_from_effective, ) -from cablexsec.provenance import Provenance +from cablexsec.provenance import Provenance, TorsionalStressWarning FloatArray = NDArray[np.float64] Frame = Literal["arc", "section"] @@ -2254,6 +2273,13 @@ class CableDynSectionHistory: Hydrostatic external pressure [Pa] (``pressure="hydrostatic"``). torque_Nm, twist_rad : numpy.ndarray or None Torque and material twist from End A, when written. + twist_rate_per_m : numpy.ndarray or None + Material twist rate [rad/m] formed from ``TwistN`` at the + section's element(s) (module notes), positive in the sense that + tightens a right-hand lay: the ``twist_rate_per_m`` input of + :func:`cablexsec.compute_fatigue` and + :func:`cablexsec.compute_conductor_fatigue`. ``None`` when the + channels are not written. """ name: str @@ -2274,6 +2300,7 @@ class CableDynSectionHistory: pressure_model: str source: str provenance: Provenance + twist_rate_per_m: FloatArray | None = None def __post_init__(self) -> None: n = np.asarray(self.time_s).size @@ -2287,6 +2314,7 @@ def __post_init__(self) -> None: "external_pressure_Pa", "torque_Nm", "twist_rad", + "twist_rate_per_m", ): values = _frozen(getattr(self, item)) if values is not None and ( @@ -2346,6 +2374,7 @@ def window( "external_pressure_Pa", "torque_Nm", "twist_rad", + "twist_rate_per_m", ): values = getattr(self, item) changes[item] = None if values is None else values[keep] @@ -2381,6 +2410,8 @@ def to_columns(self, external_area_m2: float) -> dict[str, FloatArray]: values = getattr(self, item) if values is not None: columns[item] = values + if self.twist_rate_per_m is not None: + columns["twist_rate_per_m"] = self.twist_rate_per_m return {key: np.asarray(value) for key, value in columns.items()} @@ -3518,6 +3549,52 @@ def has_components(node: int) -> bool: } twist_available = all(twist_at.values()) torque_available = all(torque_at.values()) + # Elements whose twist rate gives each section's (module notes): the + # element of a section inside it, both elements of a section on a deck + # node (one at a line end). + rate_elements: dict[str, tuple[tuple[int, int], ...]] = {} + for plan in sections_plans: + pairs: tuple[tuple[int, int], ...] + if len(plan.deck_nodes) == 2: + pairs = ((plan.deck_nodes[0][0], plan.deck_nodes[1][0]),) + else: + node = plan.deck_nodes[0][0] + pairs = tuple( + (a, a + 1) for a in (node - 1, node) if a >= 0 and a + 1 < n_deck + ) + rate_elements[plan.name] = pairs + rate_at = { + plan.name: line.torsion_solved + and all( + ("twist", line_id, j + 1) in channels + for pair in rate_elements[plan.name] + for j in pair + ) + for plan in sections_plans + } + for plan in sections_plans: + if rate_at[plan.name] or not ( + any(("twist", line_id, n + 1) in channels for n, _ in plan.deck_nodes) + or any(("torq", line_id, n + 1) in channels for n, _ in plan.deck_nodes) + ): + continue + absent = sorted( + { + f"Twist{line_id}N{j + 1}" + for pair in rate_elements[plan.name] + for j in pair + if ("twist", line_id, j + 1) not in channels + }, + key=lambda name: int(name.rsplit("N", 1)[1]), + ) + warnings.warn( + f"section {plan.name!r}: CableDyn writes twist or torque there, but " + "the twist rate of the torsional wire stress needs " + + ", ".join(absent) + + "; its fatigue would omit the torsional stress", + TorsionalStressWarning, + stacklevel=2, + ) if source != "components": twist_at = dict.fromkeys(twist_at, twist_available) torque_at = dict.fromkeys(torque_at, torque_available) @@ -3562,6 +3639,10 @@ def has_components(node: int) -> bool: "end), so the material frame needs " f"Twist{line_id}N channels at the nodes bracketing every section" ) + checks["twist_rate"] = { + name: [f"N{a + 1}-N{b + 1}" for a, b in rate_elements[name]] if ok else None + for name, ok in rate_at.items() + } checks["torsion"] = { "restrained_ends": sorted(line.torsion_restrained_ends), "solved": line.torsion_solved, @@ -3683,6 +3764,10 @@ def want(kind: str, node: int) -> None: if wanted: for node, _ in plan.deck_nodes: want(kind, node) + if rate_at[plan.name]: + for pair in rate_elements[plan.name]: + for node in pair: + want("twist", node) probe_nodes = [plan.node for plan in plans if plan.probe] for node in probe_nodes: want("curv", node) @@ -4053,6 +4138,14 @@ def append(plan: _Plan, key: str, values: FloatArray) -> None: ) append(plan, "kx", np.sum(kappa * axis1, axis=-1)) append(plan, "ky", np.sum(kappa * axis2, axis=-1)) + if rate_at[plan.name]: + rates = [ + (values[:, slot[("twist", b)]] - values[:, slot[("twist", a)]]) + / (deck_arcs[b] - deck_arcs[a]) + for a, b in rate_elements[plan.name] + ] + rate = rates[0] if len(rates) == 1 else 0.5 * (rates[0] + rates[1]) + append(plan, "twist_rate", np.radians(rate)) if ( pos_order and plan.elem_pos in pos_slot @@ -4277,6 +4370,7 @@ def share(item: dict[str, Any]) -> float: external_pressure_Pa=p_ext, torque_Nm=data.get("torque"), twist_rad=data.get("twist"), + twist_rate_per_m=data.get("twist_rate"), frame="cabledyn section axes" if source == "components" else frame, curvature_source=source, tension_source=tension_label, @@ -4317,6 +4411,18 @@ def share(item: dict[str, Any]) -> float: "channels at the section)" if source == "components" and line.torsion_solved else "no material twist (line not restrained in torsion)", + "twist rate from Twist channels at " + + ", ".join( + f"N{a + 1}-N{b + 1}" for a, b in rate_elements[plan.name] + ) + + ( + " (mean of the two element rates)" + if len(rate_elements[plan.name]) == 2 + else "" + ) + if rate_at[plan.name] + else "no twist rate (Twist channels at the section's elements " + "not written)", "hydrostatic external pressure only (no wave dynamic pressure)" if pressure == "hydrostatic" else "external pressure declared zero", @@ -4350,9 +4456,10 @@ def section_channels( nodes, ``CurvN`` there for the consistency check, and ``Twist``/``Torq`` on a line CableDyn solves in torsion (:attr:`CableDynLine.torsion_solved`; CableDyn refuses them on any other - line), with ``BodyRx/Ry/Rz`` of a body holding a restrained End A and - ``Twist`` of a line restrained at End B only (the hang-off rotation of - the module notes). With these + line), with ``Twist`` also at the node before a section that lies on a + deck node (its twist rate), and ``BodyRx/Ry/Rz`` of a body holding a + restrained End A and ``Twist`` of a line restrained at End B only (the + hang-off rotation of the module notes). With these channels alone use ``frame="section"``; the default ``frame="arc"`` also needs the ``p`` flag of the line (node positions from End A to the section; to End B on a line restrained at End B only). @@ -4383,6 +4490,10 @@ def add(name: str) -> None: if line.torsion_solved: add(f"Twist{line_id}N{node}") add(f"Torq{line_id}N{node}") + if line.torsion_solved and element > 0 and arc == arcs[element]: + # A section on a deck node: its twist rate is the mean of its two + # elements' (read_cabledyn_sections, module notes). + add(f"Twist{line_id}N{element}") # The hang-off rotation (module notes): the attitude of a body holding a # restrained End A, or the total twist of a line restrained at End B only. if line.torsion_solved and "a" in line.torsion_restrained_ends: diff --git a/src/cablexsec/provenance.py b/src/cablexsec/provenance.py index fbd2242..5500869 100644 --- a/src/cablexsec/provenance.py +++ b/src/cablexsec/provenance.py @@ -56,6 +56,7 @@ "UnevaluatedFatigueCurveWarning", "UnmodelledPolymerSofteningWarning", "UnvalidatedModelWarning", + "TorsionalStressWarning", "ValidatedRange", "check_range", "relayed_warnings", @@ -154,6 +155,18 @@ class ClampingCalibrationWarning(UserWarning): """ +class TorsionalStressWarning(UserWarning): + """The cable twists, but the torsional wire stress cannot be formed or is omitted. + + Emitted by :func:`cablexsec.io.cabledyn.read_cabledyn_sections` when + CableDyn writes ``TwistN`` or ``TorqN`` at a section but not + the ``Twist`` channels of the section's element(s) from which the twist + rate is formed (the message names them), and by the sea-state batch when + a section's history has a twist rate that is not applied. A fatigue result + of such a history then has no torsional wire stress. + """ + + class UnmodelledPolymerSofteningWarning(UserWarning): """A polymer layer runs hot with a temperature-independent modulus. diff --git a/tests/test_fatigue_torsion.py b/tests/test_fatigue_torsion.py new file mode 100644 index 0000000..c000c4b --- /dev/null +++ b/tests/test_fatigue_torsion.py @@ -0,0 +1,412 @@ +# SPDX-License-Identifier: Apache-2.0 +# Copyright (c) 2026 Jae Hoon Seo, SMI Lab, Inha University +"""Twist-rate wire stress of the fatigue path (scorecard row TQ-FT). + +The wire strain of a helical layer under the cable strain ``eps`` and twist +rate ``tau`` with plane sections and fixed radii is +``eps cos^2(a) + s R tau sin(a) cos(a)`` (Knapp 1981, Eqs. 2 and 11 with a +radially rigid core). Targets were registered before the runs: closed form +and torque/force consistency to 1e-12, mirror lay and zero twist exact. +""" + +from __future__ import annotations + +import math +import warnings + +import check_torque_balance as tq +import numpy as np +import pytest +from test_cabledyn_reader import _bending_case, _write_case + +import cablexsec as cx +from cablexsec.analysis.conductor_fatigue import ( + assess_conductor_fatigue, + ring_twist_strain_per_rate, +) +from cablexsec.analysis.fatigue import ( + compute_fatigue as compute_fatigue_specs, +) +from cablexsec.analysis.fatigue import ( + twist_stress_coefficient, + wire_stress_field, +) +from cablexsec.analysis.sea_state_batch import ( + SeaStateBatchOptions, + SeaStateRun, + SectionRequest, + run_sea_state_batch, +) +from cablexsec.exceptions import CableInputError, CableSchemaError +from cablexsec.io.cabledyn import read_cabledyn_sections, section_channels +from cablexsec.mechanics.stiffness import axial_torsional_matrix +from cablexsec.mechanics.strand_slip import ConductorRing +from cablexsec.provenance import TorsionalStressWarning + + +@pytest.fixture(scope="module") +def cable(): + return cx.load_cable(cx.iea_task49_66kv_yaml_path(), geometry_override=None) + + +@pytest.fixture(scope="module") +def checks(): + with warnings.catch_warnings(): + warnings.simplefilter("ignore") + return tq.fatigue_torsion_checks() + + +def _history(n: int = 301) -> tuple[np.ndarray, ...]: + t = np.linspace(0.0, 30.0, n) + kx = 0.03 * np.sin(2 * math.pi * t / 7.0) + ky = 0.01 * np.cos(2 * math.pi * t / 5.0) + tension = 50.0e3 + 8.0e3 * np.sin(2 * math.pi * t / 4.0) + tau = 8.0e-4 + 3.0e-4 * np.sin(2 * math.pi * t / 6.0) + return t, kx, ky, tension, tau + + +# --------------------------------------------------------------------------- # +# Registered verification (row TQ-FT) # +# --------------------------------------------------------------------------- # +@pytest.mark.analytical_sanity +def test_pure_twist_stress_and_damage_follow_the_closed_form(checks) -> None: + assert checks["closed_form"] < 1e-12 + assert checks["damage"] < 1e-12 + + +@pytest.mark.analytical_sanity +def test_wire_stresses_carry_the_section_torque_and_tension(checks) -> None: + assert checks["torque"] < 1e-12 + assert checks["force"] < 1e-12 + + +@pytest.mark.analytical_sanity +def test_mirror_lay_with_reversed_twist_and_zero_twist(checks) -> None: + assert checks["mirror"] < 1e-12 + assert checks["zero"] == 0.0 + + +# --------------------------------------------------------------------------- # +# Signs, routes and the default # +# --------------------------------------------------------------------------- # +@pytest.mark.analytical_sanity +def test_right_hand_layer_tightens_under_positive_twist(cable) -> None: + """S (left-hand) and Z (right-hand) layers take opposite twist stresses.""" + layers = {fl.name: fl for fl in cx.cable_to_fatigue_layers(cable)} + inner, outer = layers["inner_armour"], layers["outer_armour"] + assert outer.lay_hand == 1 and inner.lay_hand == -1 + assert twist_stress_coefficient(outer) > 0 > twist_stress_coefficient(inner) + a = outer.spec.lay_angle_rad + expected = outer.spec.E_wire_Pa * outer.spec.r_helix_m * math.sin(a) * math.cos(a) + assert twist_stress_coefficient(outer) == pytest.approx(expected, rel=1e-15) + m = axial_torsional_matrix(cable) + held = twist_stress_coefficient( + outer, axial_twist_coupling_Nm=m.K_et, EA_full_N=m.K_ee + ) + assert held == pytest.approx( + expected - outer.spec.E_wire_Pa * math.cos(a) ** 2 * m.K_et / m.K_ee, + rel=1e-15, + ) + + +def test_axial_strain_route_holds_the_strain(cable) -> None: + t, kx, ky, _tension, tau = _history(61) + layer = cx.cable_to_fatigue_layers(cable)[1] + strain = np.full_like(t, 1.0e-4) + base = wire_stress_field(layer, kx, ky, axial_strain=strain) + twisted = wire_stress_field( + layer, kx, ky, axial_strain=strain, twist_rate_per_m=tau + ) + added = twisted.mean_Pa - base.mean_Pa + assert np.allclose( + added, twist_stress_coefficient(layer) * tau[None, :], rtol=1e-12, atol=1e-6 + ) + assert np.array_equal(twisted.radial_Pa, base.radial_Pa) + + +def test_twist_raises_armour_damage_of_the_tightened_layer(cable) -> None: + t, kx, ky, tension, tau = _history() + options = {"tension_N": tension, "friction_model": "direction_tied"} + plain = cx.compute_fatigue(cable, kx, ky, **options) + # A twist history in phase with the tension adds range to the layer that + # it tightens, which also carries the tension stress. + swing = 2.0e-3 * (tension - tension.mean()) / 8.0e3 + twisted = cx.compute_fatigue(cable, kx, ky, twist_rate_per_m=swing, **options) + assert twisted.D_bulk_per_wire["outer_armour"].max() > ( + plain.D_bulk_per_wire["outer_armour"].max() + ) + assert twisted.provenance is not None + assert "[Knapp1981] Eqs. 2, 11" in twisted.provenance.citations + assert any("twist-rate stress" in x for x in twisted.provenance.limitations) + assert plain.provenance is not None + assert not any("twist-rate" in x for x in plain.provenance.limitations) + + +def test_default_is_unchanged_bit_for_bit(cable) -> None: + t, kx, ky, tension, _tau = _history() + options = {"tension_N": tension, "friction_model": "direction_tied"} + a = cx.compute_fatigue(cable, kx, ky, **options) + b = cx.compute_fatigue(cable, kx, ky, twist_rate_per_m=None, **options) + c = cx.compute_fatigue(cable, kx, ky, twist_rate_per_m=np.zeros_like(t), **options) + for name, values in a.D_bulk_per_fibre.items(): + assert np.array_equal(values, b.D_bulk_per_fibre[name]) + assert np.array_equal(values, c.D_bulk_per_fibre[name]) + + +@pytest.mark.parametrize("model", ["distributed", "progressive"]) +def test_twist_enters_every_friction_model_as_axial_stress(cable, model) -> None: + """The twist stress is uniform over a layer: the slip state is unchanged, + so the twisted field differs from the untwisted one by the axial term.""" + t, kx, ky, tension, tau = _history(41) + layer = cx.cable_to_fatigue_layers(cable)[0] + m = axial_torsional_matrix(cable) + options = {"friction_model": model} + base = wire_stress_field(layer, kx, ky, tension, m.K_ee, **options) + twisted = wire_stress_field( + layer, + kx, + ky, + tension, + m.K_ee, + twist_rate_per_m=tau, + axial_twist_coupling_Nm=m.K_et, + **options, + ) + coefficient = twist_stress_coefficient( + layer, axial_twist_coupling_Nm=m.K_et, EA_full_N=m.K_ee + ) + assert np.allclose( + twisted.mean_Pa - base.mean_Pa, coefficient * tau[None, :], atol=1e-5 + ) + + +def test_twist_inputs_are_checked(cable) -> None: + t, kx, ky, tension, tau = _history(41) + layers = cx.cable_to_fatigue_layers(cable) + m = axial_torsional_matrix(cable) + with pytest.raises(CableInputError, match="axial_twist_coupling_Nm"): + compute_fatigue_specs( + layers, kx, ky, tension_N=tension, EA_full_N=m.K_ee, twist_rate_per_m=tau + ) + with pytest.raises(CableInputError, match="omit axial_twist_coupling_Nm"): + compute_fatigue_specs( + layers, + kx, + ky, + axial_strain=np.full_like(t, 1e-4), + twist_rate_per_m=tau, + axial_twist_coupling_Nm=m.K_et, + ) + with pytest.raises(CableInputError, match="only with twist_rate_per_m"): + compute_fatigue_specs(layers, kx, ky, axial_twist_coupling_Nm=m.K_et) + with pytest.raises(CableInputError, match="match the curvature"): + compute_fatigue_specs(layers, kx, ky, twist_rate_per_m=tau[:-1]) + normal = {layer.name: np.full_like(t, 1e8) for layer in layers} + with pytest.raises(CableInputError, match="solved normal stress"): + compute_fatigue_specs( + layers, kx, ky, normal_stress_Pa=normal, twist_rate_per_m=tau + ) + with pytest.raises(CableSchemaError, match="qp contact model"): + cx.compute_fatigue( + cable, kx, ky, tension_N=tension, contact_model="qp", twist_rate_per_m=tau + ) + with pytest.raises(CableSchemaError, match="match the curvature"): + cx.compute_fatigue(cable, kx, ky, tension_N=tension, twist_rate_per_m=tau[:3]) + with pytest.raises(CableInputError, match="must be finite"): + twist_stress_coefficient( + layers[0], axial_twist_coupling_Nm=math.inf, EA_full_N=m.K_ee + ) + with pytest.raises(CableInputError, match="requires finite positive EA_full_N"): + twist_stress_coefficient(layers[0], axial_twist_coupling_Nm=m.K_et) + rings = (ConductorRing.from_pitch(6, 2.7e-3, 3.3e-3, 0.1196, 1.0),) + conductor = { + "sn_bulk": cx.get_sn_curve("nasution_2014_copper"), + "swt_const": None, + "mu_wire": 0.2, + } + with pytest.raises(CableInputError, match="finite axis_strain_per_twist_m"): + assess_conductor_fatigue( + rings, 1.0e11, 0.34, kx, ky, twist_rate_per_m=tau, **conductor + ) + with pytest.raises(CableInputError, match="only with twist_rate_per_m"): + assess_conductor_fatigue( + rings, 1.0e11, 0.34, kx, ky, axis_strain_per_twist_m=1e-3, **conductor + ) + with pytest.raises(CableInputError, match="match the curvature"): + assess_conductor_fatigue( + rings, + 1.0e11, + 0.34, + kx, + ky, + twist_rate_per_m=tau[:4], + axis_strain_per_twist_m=1e-3, + **conductor, + ) + + +# --------------------------------------------------------------------------- # +# Conductor # +# --------------------------------------------------------------------------- # +@pytest.mark.analytical_sanity +def test_conductor_ring_twist_strain() -> None: + ring = ConductorRing.from_pitch(24, 2.7e-3, 0.0133, 0.3588, -1.0) + a = ring.lay_angle_rad + axis = 7.2e-3 + expected = math.cos(a) ** 2 * axis - 0.0133 * math.sin(a) * math.cos(a) + assert ring_twist_strain_per_rate(ring, axis) == pytest.approx(expected, rel=1e-15) + centre = ConductorRing.from_pitch(1, 2.7e-3, 0.0, None, 1.0) + assert ring_twist_strain_per_rate(centre, axis) == axis + + +def test_conductor_takes_the_twist_strain(cable) -> None: + t, kx, ky, tension, _tau = _history(201) + conductor = cx.iea_task49_66kv_stranded() + plain = cx.compute_conductor_fatigue(conductor, kx, ky, tension_N=tension) + zero = cx.compute_conductor_fatigue( + conductor, kx, ky, tension_N=tension, twist_rate_per_m=np.zeros_like(t) + ) + assert np.array_equal(plain.D_bulk_per_orientation, zero.D_bulk_per_orientation) + # A pure twist cycle without bending or tension change: every ring's + # stress range is E * compaction * |strain per rate| * range of tau. + still = np.zeros_like(t) + tau = 2.0e-3 * np.sin(2 * math.pi * t / 6.0) + twisted = cx.compute_conductor_fatigue( + conductor, + still, + still, + tension_N=np.full_like(t, 50e3), + twist_rate_per_m=tau, + ) + layer = next(x for x in conductor.layers if getattr(x, "strand_layers", ())) + m = axial_torsional_matrix(conductor) + from cablexsec.mechanics.core_lay import core_angle # noqa: PLC0415 + + axis = (layer.r_offset_m or 0.0) * math.tan(core_angle(conductor, layer)) - ( + m.K_et / m.K_ee + ) + modulus = cx.materials.library.get_property(layer.material, "E_eff_axial_Pa") + for i, ring in enumerate(layer.strand_layers): + rings = ConductorRing.from_pitch( + ring.n_wires, + ring.d_wire_m, + ring.r_helix_m, + ring.pitch_m, + 1.0 if ring.lay_direction == "right_hand" else -1.0, + ring.wire_area_m2, + ring.compaction_scf, + ) + expected = ( + modulus + * ring.compaction_scf + * abs(ring_twist_strain_per_rate(rings, axis)) + * (tau.max() - tau.min()) + ) + assert twisted.stress_range_max_Pa[i] == pytest.approx(expected, rel=1e-9) + with pytest.raises(CableSchemaError, match="match the curvature"): + cx.compute_conductor_fatigue( + conductor, kx, ky, tension_N=tension, twist_rate_per_m=tau[:5] + ) + + +# --------------------------------------------------------------------------- # +# CableDyn reader and the sea-state batch # +# --------------------------------------------------------------------------- # +def _twisted_case(tmp_path, nodes, *, stiffness, rates=(1.0e-3, 3.0e-3)): + """Twist channels of two element rates around node 21 (s = 2.0 m).""" + nt = 31 + t = np.arange(nt) * 0.1 + positions = _bending_case(0.03 + 0.01 * np.sin(t), 0.2 * np.sin(t), nt) + arcs = np.arange(101) * 0.1 + swing = 1.0 + 0.5 * np.sin(2 * math.pi * t / 1.5) + channels = {} + for j in nodes: + s = arcs[j - 1] + # Twist [deg] from End A: rate rates[0] up to node 21, rates[1] after. + twist = rates[0] * min(s, 2.0) + rates[1] * max(s - 2.0, 0.0) + channels[f"Twist1N{j}"] = np.degrees(twist * swing) + return _write_case( + tmp_path, + positions, + tension=np.full((nt, 100), 30000.0), + channels=channels, + deck_kwargs={ + "ea": stiffness.ea_fixed_N, + "ei": stiffness.ei_min_Nm2, + "torsion": True, + }, + ), swing + + +@pytest.mark.analytical_sanity +def test_reader_forms_the_twist_rate(tmp_path, cable) -> None: + stiffness = cx.compute_stiffness(cable) + (root, deck), swing = _twisted_case(tmp_path, (20, 21, 22), stiffness=stiffness) + with warnings.catch_warnings(): + warnings.simplefilter("error", TorsionalStressWarning) + read = read_cabledyn_sections( + root, + deck, + {"on_node": 2.0, "inside": 2.05, "before": 1.95}, + pressure="none", + hang_off_rotation="none", + ) + h = read.histories + # On a node: the mean of the two element rates; inside an element: its own. + assert np.allclose(h["on_node"].twist_rate_per_m, 2.0e-3 * swing, rtol=1e-12) + assert np.allclose(h["inside"].twist_rate_per_m, 3.0e-3 * swing, rtol=1e-12) + assert np.allclose(h["before"].twist_rate_per_m, 1.0e-3 * swing, rtol=1e-12) + assert read.checks["twist_rate"]["on_node"] == ["N20-N21", "N21-N22"] + window = h["on_node"].window(1.0) + assert window.twist_rate_per_m is not None + assert window.twist_rate_per_m.size == window.time_s.size + assert "twist_rate_per_m" in h["on_node"].to_columns(0.03) + assert {"Twist1N20", "Twist1N21", "Twist1N22"} <= set( + section_channels(deck, {"on_node": 2.0}, positions=False) + ) + + +def test_reader_names_missing_twist_channels(tmp_path, cable) -> None: + stiffness = cx.compute_stiffness(cable) + (root, deck), _ = _twisted_case(tmp_path, (21, 22), stiffness=stiffness) + with pytest.warns(TorsionalStressWarning, match="needs Twist1N20"): + read = read_cabledyn_sections( + root, deck, {"a": 2.0}, pressure="none", hang_off_rotation="none" + ) + assert read.histories["a"].twist_rate_per_m is None + assert read.histories["a"].twist_rad is not None + + +def test_batch_applies_or_announces_the_twist_stress(tmp_path, cable) -> None: + stiffness = cx.compute_stiffness(cable) + (root, deck), _ = _twisted_case(tmp_path, (20, 21, 22), stiffness=stiffness) + run = SeaStateRun("r", root, deck, 1.0, hang_off_rotation="none") + sections = [SectionRequest("a", 2.0)] + base = {"tension_basis": "true", "allow_property_mismatch": True} + with pytest.warns(TorsionalStressWarning, match="twist_stress is False"): + off = run_sea_state_batch( + cable, [run], sections, options=SeaStateBatchOptions(**base) + ) + on = run_sea_state_batch( + cable, + [run], + sections, + options=SeaStateBatchOptions(twist_stress=True, **base), + ) + assert off.manifest["inputs_sha256"] != on.manifest["inputs_sha256"] + d_off = off.sections["a"].long_term.annual_damage_per_fibre + d_on = on.sections["a"].long_term.annual_damage_per_fibre + assert any(not np.array_equal(d_off[k], d_on[k]) for k in d_off) + (tmp_path / "b").mkdir() + (root2, deck2), _ = _twisted_case(tmp_path / "b", (21, 22), stiffness=stiffness) + with ( + pytest.raises(CableSchemaError, match="twist_stress needs"), + warnings.catch_warnings(), + ): + warnings.simplefilter("ignore") + run_sea_state_batch( + cable, + [SeaStateRun("r", root2, deck2, 1.0, hang_off_rotation="none")], + sections, + options=SeaStateBatchOptions(twist_stress=True, **base), + ) diff --git a/validation/scripts/check_torque_balance.py b/validation/scripts/check_torque_balance.py index 9889cc5..d266cc5 100644 --- a/validation/scripts/check_torque_balance.py +++ b/validation/scripts/check_torque_balance.py @@ -26,6 +26,10 @@ * Utting and Jones (1987), Int. J. Mech. Sci. 29, Part I Table 1 (core 3.94 mm, wires 3.73 mm, measured lay angles) and Part II Table 1 (fixed-end torque per kN: Machida-Durelli theory, column ii, and test, column vii). +* Knapp (1981), Eqs. 2 and 11 with a radially rigid core (theta = 0): the + wire strain ``eps cos^2(a) + gamma sin^2(a)`` with the twist strain + ``gamma = R tau / tan(a)``, i.e. ``eps cos^2(a) + s R tau sin(a) cos(a)``, + the twist-rate stress of the fatigue path (row TQ-FT). """ from __future__ import annotations @@ -33,8 +37,20 @@ import math import warnings +import numpy as np + +import cablexsec as cx +from cablexsec.analysis.fatigue import ( + FatigueLayer, + miner_damage, + twist_stress_coefficient, + wire_stress_field, +) from cablexsec.analysis.torque_balance import design_torque_balance, torque_balance from cablexsec.cables.schema import CableData, CableMeta, CylindricalLayer, HelicalLayer +from cablexsec.materials import library +from cablexsec.materials.sn_curves import get_sn_curve +from cablexsec.mechanics.mkappa import HelicalLayerSpec from cablexsec.mechanics.stiffness import axial_torsional_matrix STEEL = "galvanised_steel_armour" # E and nu cancel or are stated per case @@ -68,6 +84,8 @@ "VI": (9.23, 0.498, 0.47), } UJ_TENSION_N = 40.0e3 # Part II Table 1 load range +#: Any stress-range curve in MPa: TQ-FT compares stresses and Miner sums. +SN_CURVE = "oc2017_armour_in_air" # --------------------------------------------------------------------------- # @@ -269,6 +287,171 @@ def published_checks() -> dict[str, float]: } +# --------------------------------------------------------------------------- # +# Twist-rate stress of the fatigue path (row TQ-FT) # +# --------------------------------------------------------------------------- # +FT_TENSION_N = 60.0e3 +FT_TWIST = 1.0e-3 # rad/m, amplitude of the twist history +FT_SAMPLES = 401 + + +def _rope_fatigue_layers(cable: CableData) -> list[FatigueLayer]: + """Fatigue layers of a strand straight from its schema data.""" + curve = get_sn_curve(SN_CURVE) + out = [] + for layer in cable.helical_layers: + assert layer.n_wires and layer.r_helix_m and layer.d_wire_m + spec = HelicalLayerSpec( + n_wires=layer.n_wires, + r_helix_m=layer.r_helix_m, + lay_angle_rad=math.radians(abs(layer.lay_angle_deg or 0.0)), + E_wire_Pa=library.get_property(layer.material, "E_Pa"), + A_wire_m2=math.pi * layer.d_wire_m**2 / 4, + xi=1.0, + mu=0.0, + F_n_axi_N=0.0, + ) + out.append( + FatigueLayer( + spec=spec, + sn_bulk=curve, + sigma_UTS_Pa=1.0e9, + name=layer.name, + lay_hand=1 if layer.lay_direction == "right_hand" else -1, + ) + ) + return out + + +def _closed_form_stress( + layer: HelicalLayer, k_et: float, k_ee: float, tension: float, tau: np.ndarray +) -> np.ndarray: + """Knapp (1981) Eqs. 2, 11 (theta = 0) with eps = (T - K_et tau) / K_ee.""" + e = library.get_property(layer.material, "E_Pa") + a = math.radians(abs(layer.lay_angle_deg or 0.0)) + s = 1.0 if layer.lay_direction == "right_hand" else -1.0 + assert layer.r_helix_m is not None + eps = (tension - k_et * tau) / k_ee + helix = s * layer.r_helix_m * math.sin(a) * math.cos(a) + return np.asarray(e * (math.cos(a) ** 2 * eps + helix * tau)) + + +def fatigue_torsion_checks() -> dict[str, float]: + """Scorecard row TQ-FT: the twist-rate wire stress of the fatigue path. + + * ``closed_form``: largest relative error of the recovered wire stress of + the 66 kV template armour (adapter-built layers) under tension and a + twist history without bending, against the closed form from the schema + data; ``damage`` the same for the per-wire damage of + :func:`cablexsec.compute_fatigue` against the Miner sum of the + closed-form history. + * ``torque``, ``force``: the Feyrer 1x37 rope, whose helical layers alone + carry ``K_et`` and ``K_tt``: torque ``sum s n A sigma R sin(a)`` and + axial force ``sum n A sigma cos(a) + E A_core eps`` of the fatigue + stresses at ``(T, tau)`` against ``K_et eps + K_tt tau`` and ``T``. + * ``mirror``: every lay reversed and the twist negated, bending included: + largest relative difference of the per-wire damage. + * ``zero``: zero twist against no twist input: largest absolute damage + difference, armour fibres and conductor azimuths (bit for bit: 0). + """ + t = np.linspace(0.0, 40.0, FT_SAMPLES) + tau = FT_TWIST * (0.3 + np.sin(2 * math.pi * t / 10.0)) + zero_k = np.zeros_like(t) + tension = np.full_like(t, FT_TENSION_N) + cable = cx.load_cable(cx.iea_task49_66kv_yaml_path(), geometry_override=None) + m = axial_torsional_matrix(cable) + layers = cx.cable_to_fatigue_layers(cable, contact_tension_N=FT_TENSION_N) + exact = { + layer.name: _closed_form_stress( + cable.get_layer(layer.name), # type: ignore[arg-type] + m.K_et, + m.K_ee, + FT_TENSION_N, + tau, + ) + for layer in layers + } + closed = 0.0 + for layer in layers: + field = wire_stress_field( + layer, + zero_k, + zero_k, + tension, + m.K_ee, + twist_rate_per_m=tau, + axial_twist_coupling_Nm=m.K_et, + ) + ref = exact[layer.name] + error = np.max(np.abs(field.mean_Pa - ref)) / np.max(np.abs(ref)) + closed = max(closed, float(error)) + result = cx.compute_fatigue( + cable, + zero_k, + zero_k, + tension_N=tension, + twist_rate_per_m=tau, + friction_model="direction_tied", + ) + damage = 0.0 + for layer in layers: + ref_damage = miner_damage(exact[layer.name], layer.sn_bulk, layer.sigma_UTS_Pa) + got = result.D_bulk_per_wire[layer.name] + damage = max(damage, float(np.max(np.abs(got - ref_damage))) / ref_damage) + + rope = feyrer_rope() + mr = axial_torsional_matrix(rope) + t0, tau0 = 10.0e3, 2.0e-3 + eps = (t0 - mr.K_et * tau0) / mr.K_ee + torque = 0.0 + force = library.get_property(STEEL, "E_Pa") * math.pi * FEYRER_D0**2 / 4 * eps + for fl in _rope_fatigue_layers(rope): + spec = fl.spec + a = spec.lay_angle_rad + sigma = spec.E_wire_Pa * math.cos(a) ** 2 * t0 / mr.K_ee + tau0 * ( + twist_stress_coefficient( + fl, axial_twist_coupling_Nm=mr.K_et, EA_full_N=mr.K_ee + ) + ) + area = spec.n_wires * spec.A_wire_m2 + torque += fl.lay_hand * area * sigma * spec.r_helix_m * math.sin(a) + force += area * sigma * math.cos(a) + torque_ref = mr.K_et * eps + mr.K_tt * tau0 + + kx = 0.03 * np.sin(2 * math.pi * t / 7.0) + ky = 0.01 * np.cos(2 * math.pi * t / 5.0) + options = {"tension_N": tension, "friction_model": "direction_tied"} + base = cx.compute_fatigue(cable, kx, ky, twist_rate_per_m=tau, **options) + flipped = cx.compute_fatigue( + mirror_lay(cable), kx, ky, twist_rate_per_m=-tau, **options + ) + mirror = max( + float(np.max(np.abs(flipped.D_bulk_per_wire[k] - v)) / np.max(v)) + for k, v in base.D_bulk_per_wire.items() + ) + none = cx.compute_fatigue(cable, kx, ky, **options) + zeros = cx.compute_fatigue(cable, kx, ky, twist_rate_per_m=zero_k, **options) + zero = max( + float(np.max(np.abs(zeros.D_bulk_per_fibre[k] - v))) + for k, v in none.D_bulk_per_fibre.items() + ) + conductor = cx.iea_task49_66kv_stranded() + c_none = cx.compute_conductor_fatigue(conductor, kx, ky, tension_N=tension) + c_zero = cx.compute_conductor_fatigue( + conductor, kx, ky, tension_N=tension, twist_rate_per_m=zero_k + ) + difference = c_zero.D_bulk_per_orientation - c_none.D_bulk_per_orientation + zero = max(zero, float(np.max(np.abs(difference)))) + return { + "closed_form": closed, + "damage": damage, + "torque": abs(torque / torque_ref - 1.0), + "force": abs(force / t0 - 1.0), + "mirror": mirror, + "zero": zero, + } + + def main() -> None: print("Feyrer (2015) Example 2.8") for key, value in feyrer().items(): @@ -299,6 +482,9 @@ def main() -> None: f" torque {a.torque_fixed_Nm[-1]:.6g} / {b.torque_fixed_Nm[-1]:.6g}; " f"twist {a.twist_free_rad_per_m[-1]:.6g} / {b.twist_free_rad_per_m[-1]:.6g}" ) + print("Twist-rate wire stress of the fatigue path (TQ-FT)") + for key, value in fatigue_torsion_checks().items(): + print(f" {key:12s} {value:.3g}") if __name__ == "__main__": diff --git a/validation/scripts/run_validation.py b/validation/scripts/run_validation.py index cf1a611..8d31623 100644 --- a/validation/scripts/run_validation.py +++ b/validation/scripts/run_validation.py @@ -1007,7 +1007,8 @@ def _torque_rows() -> list[Row]: v = tq.verification_checks() p = tq.published_checks() w = sv.verification_checks() - # The first two rows are tier 1 and are reported with the analytical rows. + ft = tq.fatigue_torsion_checks() + # The first three rows are tier 1 and are reported with the analytical rows. return [ Row( "1", @@ -1036,6 +1037,24 @@ def _torque_rows() -> list[Row]: if abs(w["rectangle"]) < 3e-4 and abs(w["annulus"]) < 1e-6 else "FAIL", ), + Row( + "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", + f"{max(ft['closed_form'], ft['damage']):.1e}; " + f"{max(ft['torque'], ft['force']):.1e}; {ft['mirror']:.1e}; " + f"{ft['zero']:.1e}", + "PASS" + if max(ft["closed_form"], ft["damage"]) < 1e-12 + and max(ft["torque"], ft["force"]) < 1e-12 + and ft["mirror"] < 1e-12 + and ft["zero"] == 0.0 + else "FAIL", + ), Row( "2", "TQ-KL", @@ -1502,7 +1521,7 @@ def _rows() -> list[Row]: ) torque_rows = _torque_rows() - rows.extend(torque_rows[:2]) + rows.extend(torque_rows[:3]) # A11 energy closure on a synthetic dense layer (loop area vs closed form). from cablexsec.mechanics.mkappa import HelicalLayerSpec # noqa: PLC0415 @@ -1992,7 +2011,7 @@ def _comp_row(tier: str, ident: str, quantity: str, keys: tuple[str, ...]) -> Ro ("OST12-in", "OST12-out", "OST12-sum"), ) ) - rows.extend(torque_rows[2:]) + rows.extend(torque_rows[3:]) ei_min = ei_min_slip(menard) rows.append( Row( diff --git a/validation/validation_report.md b/validation/validation_report.md index 9a4d3f7..c24e45c 100644 --- a/validation/validation_report.md +++ b/validation/validation_report.md @@ -23,6 +23,7 @@ Every row is computed from published data or closed-form references in this repo | 1 | FR | Fretting regime: Mindlin energy vs numerical Masing loop; Fouvry A/D/B at transition; Cattaneo strip I(0) = pi/16; mu = inf stick energy; planar-path rotation | < 1e-9; < 1e-12; < 1e-12; 0 J; < 1e-12 relative | 7.8e-12; 4.4e-16; 1.6e-15; 0.0e+00 J; 4.4e-16 | PASS | | 1 | TQ | Torque balance: Feyrer Ex. 2.8 torque constant c_1S (fixed radius); coupled section vs Knapp (1981) core factor, theta = 2 nu; mirror lay reverses torque and twist | 0.0345 +/- 0.2%; < 1e-4 relative; < 1e-9 relative | 0.03446 (-0.11%); -1.3e-06; 0.0e+00 | PASS | | 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 | M-rec | Assembled per-wire moment vs compute_mkappa (cross-engine, single-core) | < 2% | 0.000% | PASS | @@ -78,7 +79,7 @@ Every row is computed from published data or closed-form references in this repo ## Test taxonomy (full gate suite) -- analytical_sanity: `1248 passed` +- analytical_sanity: `1254 passed` - independent_method: `77 passed` - full_scale: `59 passed`