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

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 18 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -244,6 +244,23 @@ All notable changes to CableXSec are recorded in this file. The format follows

### Changed

- `read_cabledyn_sections` places the `Dec`/`Azi` tangents of a finite-EI line (any section
with `EI > 0`) at their nodes, as CableDyn 0.4.2 and later write them: the node's own
cubic-Hermite tangent. Every value was placed at the mid-arc of the chord between the
neighbouring nodes, so an end node's tangent (the hang-off) sat half an element inside the
line, and on a non-uniform mesh the interior tangents near a change of element length were
shifted too. On the 128-element lazy-wave test run of CableDyn 0.4.2 (0.2 m elements at the
hang-off) the curvature at node 2 departed from CableDyn's `Curv` by 52 % and at node 3 by
15 %, so the read failed its curvature check where `Curv` channels were written near the
hang-off; without them it returned a largest curvature 0.25 m from the hang-off 14.5 % high
(9.59e-3 against 8.37e-3 1/m). Now all checked nodes agree to 2.5e-4. Chords of an `EI = 0`
line stay at their mid-arcs. `run_sea_state_batch` takes the option as
`SeaStateBatchOptions.tangent_placement`. The output files carry no version marker; `tangent_placement="chord"` reads
finite-EI output of CableDyn 0.4.1 and earlier, the placement is recorded in
`checks["tangent_placement"]` and the provenance, and a failed curvature check names the
option. The test run `tests/data/cabledyn/lw128` is now CableDyn 0.4.2 output (its nodal
tension recovery moves the mean sag-bend `Te` of how-to 10 from 1.75 to 1.33 kN); the v0.1.0
run is kept as `lw128_v010`.
- Templates whose source describes a layer as a yarn serving now declare it as one. The Chae,
Nam and Shim (2023) coiling cable's two yarn layers: full-slip EI 47.3 to 30.6 kN·m², stick EI
876 to 860 kN·m², fixed-end EA 631 to 626 MN, solved torsional secant under the source's
Expand Down Expand Up @@ -374,8 +391,7 @@ All notable changes to CableXSec are recorded in this file. The format follows
describe CableDyn 0.4.x: node tension, curvature and bend moment recovered from nodal
equilibrium (since CableDyn 0.2.0), the signed section-axis components `CurvX`/`CurvY` and
torsion of lines restrained at one end (since 0.4.0), and the node tangent of finite-EI lines
in the `Dec`/`Azi` channels (since 0.4.2; the tangent reader places an end node's tangent half
an element inside the line on such output). The `compute_mkappa` docstring states that
in the `Dec`/`Azi` channels (since 0.4.2; see Changed). The `compute_mkappa` docstring states that
`tension_N` is the true wall tension, as in `compute_fatigue`.
- The slip of the distributed friction model over a full-slip increment (every helix node on its
bound) is now unique. The equations fix the forces, the tractions and `u − p` there, but not a
Expand Down
38 changes: 29 additions & 9 deletions doc/global_local_guide.md
Original file line number Diff line number Diff line change
Expand Up @@ -50,10 +50,10 @@ channel, the item says so.
(one-sided at the ends). From CableDyn 0.4.2 a finite-EI line writes the
node's own tangent, the cubic-Hermite tangent degree of freedom (at an end
clamped by a `Rigid` row, the direction the clamp holds); an `EI = 0` line
keeps the chord. The reader places every value at the mid-arc of the chord
(Section 2): at an interior node of a uniform mesh that is the node itself,
but the tangent of an end node of 0.4.2 output is then taken half an
element inside the line.
keeps the chord. The output files carry no version marker. The reader
(Section 2) places a node tangent at its node and a chord at its mid-arc;
`tangent_placement="chord"` reads finite-EI output of CableDyn 0.4.1 and
earlier.
- **Tension.** Effective tension of a solid line without contents
(`T_e = EA ε`). On a finite-EI line `Ten<L>N<J>` is the axial component of
the section force recovered from nodal equilibrium (since CableDyn 0.2.0;
Expand All @@ -78,11 +78,20 @@ returns, per section at unstretched arc length `s` from End A:
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 chord tangents
of the `Dec`/`Azi` channels (each placed at the mid-arc of its chord) through a
few nodes on either side (`window_nodes`, default 3) and forms
`κ = t × dt/ds`. `"positions"` splines node positions and forms
`κ = r' × r'' / |r'|³`; the 8-digit position format limits its resolution to
**Curvature vector.** `curvature_source="tangent"` splines the tangents of
the `Dec`/`Azi` channels through a few nodes on either side (`window_nodes`,
default 3) and forms `κ = t × dt/ds`. With the default
`tangent_placement="auto"` (CableDyn 0.4.2 and later) the tangent of a
finite-EI line (any section with `EI > 0`) sits at its node and the chord of an
`EI = 0` line at the mid-arc of the chord (an end node at the mid-arc of its
element); `tangent_placement="chord"` places every value at the mid-arc of its
chord, for finite-EI output of CableDyn 0.4.1 and earlier. The placement is
recorded in `checks["tangent_placement"]`. Reading one version's output as the
other's moves the End-A tangent by half an element: 0.4.2 output of the
128-element lazy-wave test run (0.2 m elements at the hang-off) read with
`"chord"` puts the curvature at node 2 52 % away from CableDyn's `Curv`, and
the curvature check fails with a message that names the option.
`"positions"` splines node positions and forms `κ = r' × r'' / |r'|³`; the 8-digit position format limits its resolution to
about `δ/h²` (`δ` the last printed digit, `h` the element length: 2.2e-4 1/m
for the 0.15 m elements of the 80 m lazy-wave example), recorded in the checks.
`"auto"` uses tangents when all needed channels are present.
Expand Down Expand Up @@ -303,6 +312,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 φ)` |
| 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 |
| Batch annual damage against `Σ p_i s_year D_i/T_i` from direct `compute_fatigue` | equal to 1e-12 at every fibre |
Expand Down Expand Up @@ -337,6 +347,16 @@ Hs 3 m/Tp 9 s/30°, weights 0.5/0.3/0.2, first 20 s discarded):
- Run time: 4 sections × 3 runs (2401 rows each; reading about 2 s per run
including file digests), 10.4 s on one worker, 8.4 s on two.

CableDyn 0.4.2 output (the 128-element run `lw128` in `tests/data/cabledyn`:
the same cable with 0.2 m elements over the first 6 m and 1.24 m beyond,
Hs 4 m/Tp 10 s/30°, 20 s): the curvature from the node tangents agrees with
`Curv1N<J>` at the hang-off nodes 2 to 4 and the sag-bend nodes 71 to 75 to
2.5e-4 of each node's largest value. Read with `tangent_placement="chord"`,
nodes 2 and 3 depart by 52 % and 15 %, the largest hang-off curvature at
0.25 m is 14.5 % higher (9.59e-3 against 8.37e-3 1/m), and the read fails
the curvature check. The v0.1.0 run of the same deck (`lw128_v010`) read
with `tangent_placement="chord"` agrees to 1.5 % at nodes 2 and 3.

The IEA Task 49 66 kV template stood in for the local section; its `EA` and
`EI` differ from the Lozon cable of the deck, so these runs check the
plumbing and the conventions, not a design result
Expand Down
2 changes: 1 addition & 1 deletion doc/howto.md
Original file line number Diff line number Diff line change
Expand Up @@ -314,7 +314,7 @@ ASCII time history.
```text
curvature from tangent channels
hangoff 201 samples, dt 0.1 s, Te mean 9.28 kN, true mean 6.40 kN, |kappa| max 0.0084 1/m
sag 201 samples, dt 0.1 s, Te mean 1.75 kN, true mean -11.20 kN, |kappa| max 0.0984 1/m
sag 201 samples, dt 0.1 s, Te mean 1.33 kN, true mean -11.61 kN, |kappa| max 0.0990 1/m
riflex 240 samples, 59.8 s, effective tension 65.25 kN mean, kappa_x -0.0155 to 0.0156 1/m
```

Expand Down
5 changes: 5 additions & 0 deletions src/cablexsec/analysis/sea_state_batch.py
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,7 @@
CableDynSectionHistory,
CurvatureSource,
Frame,
TangentPlacement,
read_cabledyn_deck,
read_cabledyn_sections,
)
Expand Down Expand Up @@ -199,6 +200,9 @@ class SeaStateBatchOptions:
wire_positions: WirePositions | None = None
frame: Frame = "arc"
curvature_source: CurvatureSource = "auto"
#: ``"chord"`` reads finite-EI output of CableDyn 0.4.1 and earlier
#: (:func:`~cablexsec.io.cabledyn.read_cabledyn_sections`).
tangent_placement: TangentPlacement = "auto"
reference_vector: tuple[float, float, float] = (0.0, 0.0, 1.0)
tension_basis: TensionBasis = "auto"
external_diameter_m: float | None = None
Expand Down Expand Up @@ -493,6 +497,7 @@ def _evaluate(task: _Task) -> dict[str, Any]:
line_id=run.line_id,
frame=opts.frame,
curvature_source=opts.curvature_source,
tangent_placement=opts.tangent_placement,
reference_vector=opts.reference_vector,
pressure="hydrostatic" if task.basis == "true" else "none",
chunk_rows=opts.chunk_rows,
Expand Down
93 changes: 74 additions & 19 deletions src/cablexsec/io/cabledyn.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,14 @@

* ``curvature_source="tangent"``: node tangents from the ``L<L>N<J>Dec`` and
``L<L>N<J>Azi`` channels (written with 8 significant digits of the angle).
Up to CableDyn 0.4.1 these are the chord between the neighbouring nodes, so
each value is placed at the mid-arc of that chord (an end node at the
mid-arc of its element). From 0.4.2 a finite-EI line writes the node's own
tangent: at an interior node of a uniform mesh the chord mid-arc is the
node, but an end tangent is then taken half an element inside the line.
Since CableDyn 0.4.2 a finite-EI line (any section with ``EI > 0``) writes
the node's own tangent, the cubic-Hermite tangent degree of freedom (at an
end clamped by a ``Rigid`` row, the direction the clamp holds), and each
value is placed at its node. An ``EI = 0`` line writes the chord between
the neighbouring nodes (one-sided at the ends), placed at the mid-arc of
that chord (an end node at the mid-arc of its element). Up to CableDyn
0.4.1 a finite-EI line also wrote chords; ``tangent_placement="chord"``
reads such output (the files carry no version marker).
A cubic spline through the tangents of a few nodes on either
side of the section gives :math:`\mathbf{t}` and
:math:`\boldsymbol{\kappa}=\mathbf{t}\times\mathrm{d}\mathbf{t}/\mathrm{d}s`.
Expand Down Expand Up @@ -117,6 +120,7 @@
Frame = Literal["arc", "section"]
CurvatureSource = Literal["auto", "tangent", "positions"]
PressureModel = Literal["hydrostatic", "none"]
TangentPlacement = Literal["auto", "chord"]

__all__ = [
"CableDynDeck",
Expand Down Expand Up @@ -1095,6 +1099,7 @@ def read_cabledyn_sections(
line_id: int = 1,
frame: Frame = "arc",
curvature_source: CurvatureSource = "auto",
tangent_placement: TangentPlacement = "auto",
reference_vector: Sequence[float] = (0.0, 0.0, 1.0),
pressure: PressureModel = "hydrostatic",
window_nodes: int = 3,
Expand Down Expand Up @@ -1122,6 +1127,12 @@ def read_cabledyn_sections(
curvature_source : {"auto", "tangent", "positions"}
``"auto"`` uses the tangent channels when every section has them and
positions otherwise; the choice is recorded.
tangent_placement : {"auto", "chord"}
Where the ``Dec``/``Azi`` values sit along the line. ``"auto"``
(CableDyn 0.4.2 and later): at the node on a finite-EI line, at the
mid-arc of the chord on an ``EI = 0`` line. ``"chord"``: at the
mid-arc of the chord on every line, for the output of CableDyn 0.4.1
and earlier. The placement is recorded in ``checks``.
reference_vector : sequence of 3 floats
Seed vector ``a`` of the frame (default global +z).
pressure : {"hydrostatic", "none"}
Expand Down Expand Up @@ -1149,6 +1160,8 @@ def read_cabledyn_sections(
raise CableSchemaError("frame must be 'arc' or 'section'")
if curvature_source not in ("auto", "tangent", "positions"):
raise CableSchemaError("curvature_source must be auto, tangent or positions")
if tangent_placement not in ("auto", "chord"):
raise CableSchemaError("tangent_placement must be 'auto' or 'chord'")
if tension_source not in ("auto", "segments", "nodes"):
raise CableSchemaError("tension_source must be auto, segments or nodes")
if pressure not in ("hydrostatic", "none"):
Expand Down Expand Up @@ -1276,6 +1289,20 @@ def has_position(node: int) -> bool:
if not plan.probe or all(needed_curvature(j) for j in plan.window)
]
checks["curvature_source"] = source
finite_ei = any(
deck_obj.line_type(sec.line_type).ei_Nm2 > 0.0 for sec in line.sections
)
if source == "tangent":
if tangent_placement == "chord":
checks["tangent_placement"] = (
"chord mid-arc (tangent_placement='chord': CableDyn 0.4.1 and earlier)"
)
elif finite_ei:
checks["tangent_placement"] = (
"node (finite-EI line: node tangent, CableDyn 0.4.2 and later)"
)
else:
checks["tangent_placement"] = "chord mid-arc (EI = 0 line)"

# Nodes whose positions are needed: frame transport (arc), elevation.
pos_nodes: set[int] = set()
Expand Down Expand Up @@ -1413,12 +1440,18 @@ def want(kind: str, node: int) -> None:

reference_l0 = np.diff(arcs)
midpoints = 0.5 * (arcs[:-1] + arcs[1:])
chord_mid = np.array(
[
0.5 * (arcs[max(j - 1, 0)] + arcs[min(j + 1, n_nodes - 1)])
for j in range(n_nodes)
]
)
# Arc length of each Dec/Azi value: the node's own tangent of a finite-EI
# line (CableDyn 0.4.2+) at the node; a chord (central, one-sided at the
# ends) at its mid-arc, the point of a smooth arc whose tangent it is.
if tangent_placement == "auto" and finite_ei:
tangent_arcs = arcs
else:
tangent_arcs = np.array(
[
0.5 * (arcs[max(j - 1, 0)] + arcs[min(j + 1, n_nodes - 1)])
for j in range(n_nodes)
]
)
state_a: FloatArray | None = None
state_section: dict[str, FloatArray | None] = {
plan.name: None for plan in sections_plans
Expand Down Expand Up @@ -1564,7 +1597,7 @@ def append(plan: _Plan, key: str, values: FloatArray) -> None:
),
axis=-1,
)
value, d1, _ = _spline(chord_mid[plan.window], samples, plan.arc)
value, d1, _ = _spline(tangent_arcs[plan.window], samples, plan.arc)
tangent = _unit(value, "section tangent")
kappa = np.cross(tangent, d1)
else:
Expand Down Expand Up @@ -1695,8 +1728,9 @@ def append(plan: _Plan, key: str, values: FloatArray) -> None:
mine = np.concatenate(plan.data["norm"])
channel = np.concatenate(plan.data["channel"])
error = float(np.max(np.abs(mine - channel)))
# End nodes and their neighbours: the spline uses the one-sided end
# chord, CableDyn the end element's own curvature.
# End nodes and their neighbours: the spline window is one-sided
# there (and starts from the one-sided end chord on chord output),
# CableDyn reports the end element's own curvature.
end = node <= 2 or node >= n_nodes - 1
allowed = atol + (
curvature_check_end_rtol if end else curvature_check_rtol
Expand Down Expand Up @@ -1730,12 +1764,27 @@ def share(item: dict[str, Any]) -> float:
worst_name = max(failed, key=lambda name: share(failed[name]))
worst = failed[worst_name]
percent = 100.0 * share(worst)
rtol = curvature_check_end_rtol if worst["near_end"] else curvature_check_rtol
placement = ""
if source == "tangent" and finite_ei:
placement = (
f" The tangents were placed at the {checks['tangent_placement']}; "
+ (
"output of CableDyn 0.4.2 and later needs the default "
"tangent_placement='auto'."
if tangent_placement == "chord"
else "output of CableDyn 0.4.1 and earlier needs "
"tangent_placement='chord'."
)
)
raise CableSchemaError(
"the curvature reconstructed from the node positions differs from "
"the curvature reconstructed from the node "
f"{'tangents' if source == 'tangent' else 'positions'} differs from "
f"CableDyn's own curvature output (channel Curv{line_id}{worst_name}, "
"and the other curvature channels) by more than the curvature check "
f"tolerance ({100.0 * curvature_check_rtol:g} % of the largest "
"curvature, plus the resolution of the positions) at "
f"tolerance ({100.0 * rtol:g} % of the largest "
"curvature there, plus the resolution of the "
f"{'angles' if source == 'tangent' else 'positions'}) at "
f"{len(failed)} of {checked} checked nodes; at node "
f"{worst_name.removeprefix('N')} by {worst['max_abs_error_1_m']:.3g} "
f"1/m, {percent:.0f} % of its largest value "
Expand All @@ -1744,7 +1793,8 @@ def share(item: dict[str, Any]) -> float:
"resolve the curvature there (CableDyn reports the larger one-sided "
"element value, which on a coarse mesh departs from the curvature of "
"the deformed line): refine the mesh, or raise the curvature check "
f"tolerance if a difference of {percent:.0f} % is acceptable"
f"tolerance if a difference of {percent:.0f} % is acceptable."
f"{placement}"
)
checks["curvature_vs_channels"] = curvature_checks

Expand Down Expand Up @@ -1787,7 +1837,12 @@ def share(item: dict[str, Any]) -> float:
),
limitations=(
"curvature vector reconstructed from the solved centreline; "
f"source: {source}",
f"source: {source}"
+ (
f"; tangents placed at the {checks['tangent_placement']}"
if source == "tangent"
else ""
),
f"twist-free {frame} frame seeded by e2 = a x t, "
f"a = {tuple(float(v) for v in reference)}; hang-off roll about "
"its own tangent is not represented",
Expand Down
Loading
Loading