diff --git a/ARCHITECTURE.md b/ARCHITECTURE.md index 795452e..c1d870e 100644 --- a/ARCHITECTURE.md +++ b/ARCHITECTURE.md @@ -40,7 +40,7 @@ src/cablexsec/ materials/ material property library, S-N/SWT curve registry mechanics/ section, contact, helix and thermal kernels analysis/ stress, fatigue, long-term, capacity, components, life - io/ load histories, CSV/RIFLEX/CableDyn readers, synthetic seas + io/ load histories, CSV/ASCII-column/CableDyn readers, synthetic seas plotting/ publication figures and an HTML result viewer ``` @@ -193,7 +193,7 @@ Functional kernels operating on arrays; most are not called directly by users. deck ([doc/global_local_guide.md](doc/global_local_guide.md)). - `cabledyn_components.py`: station histories from the signed section-frame curvature components `CurvX`/`CurvY` that CableDyn writes since 0.4.0. -- `riflex_reader.py`: RIFLEX ASCII results. +- `ascii_columns_reader.py`: whitespace-column ASCII time histories. - `synthetic.py`: self-contained JONSWAP-style load-series generator. ### `plotting` @@ -277,7 +277,7 @@ Key invariants: bit. 4. Imported true-force histories drive both axial stress and contact by default, matching the direct API. -5. Every global reader (time-history CSV, CableDyn, RIFLEX rotation input) converts +5. Every global reader (time-history CSV, CableDyn, ASCII-column rotation input) converts rotation curvature through the one function `section_conventions.rotation_to_strain_curvature`, so a fibre angle `φ` (from local x towards y) names the same physical fibre whichever code diff --git a/CHANGELOG.md b/CHANGELOG.md index f3324f0..0d213d0 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -45,6 +45,11 @@ All notable changes to CableXSec are recorded in this file. The format follows ### Changed +- `read_riflex_ascii` is renamed `read_ascii_columns` (module `cablexsec.io.ascii_columns_reader`, + breaking). It reads whitespace-separated columns by position and was never checked against + output of the program it was named after, so the docs, the how-to and the provenance no longer + name one. Its arguments and results are unchanged. + - The thermal ladder follows IEC 60287-1-1:2023 and IEC 60287-2-1:2023, and the loss terms are computed from the cable unless given (they defaulted to zero, which put the conductor loss of a 630 mm² three-core cable about 9 % low, and more with its sheath loss): @@ -97,6 +102,11 @@ All notable changes to CableXSec are recorded in this file. The format follows ### Documentation +- The thermal docs state the accuracy limit of the IEC single-core-equivalent ladder for + three-core cables: against 2-D finite-element models, Chatzipetros and Pilgrim (2018) found + it reads the conductor temperature up to 8 °C low for SL-type lead sheaths and 4.9 to 5.9 °C + low for foil screens. + - The thermal modules and guides cite the 2023 editions of IEC 60287-1-1, IEC 60287-2-1 and IEC 60228 by clause and drop the notes that the standards were not held. They state that a three-core cable with spaced-wire core screens is treated as belted by IEC 60287-2-1 diff --git a/CITATION.cff b/CITATION.cff index 36964f9..af1ce7b 100644 --- a/CITATION.cff +++ b/CITATION.cff @@ -12,7 +12,7 @@ abstract: >- hysteretic moment-curvature response of helical armour with frictional slip, wire and component stresses, contact pressures and slip, temperatures, and fatigue damage at fixed material points of every wire. It reads global - results of CableDyn, RIFLEX and CSV exports and turns them into fatigue damage + results of CableDyn and CSV exports and turns them into fatigue damage of the armour, the conductor and the sheaths. authors: - family-names: Seo diff --git a/README.md b/README.md index dd1e668..c3980f4 100644 --- a/README.md +++ b/README.md @@ -14,8 +14,8 @@ moment–curvature response that follows, the stress of every wire and component material points, the contact pressures that set the friction, the temperatures, and the fatigue damage of the armour, the conductor and the metallic sheaths. -It reads the results of global analyses (CableDyn, RIFLEX, and time-history CSV exports such as -those of OrcaFlex) and turns them into local stresses and damage, and it exports a hysteretic +It reads the results of global analyses (CableDyn runs and time-history CSV exports such +as those of OrcaFlex) and turns them into local stresses and damage, and it exports a hysteretic bending law for use in global analysis. The current release is `v0.2.1`; interfaces are versioned and may change before `1.0.0`. diff --git a/RELEASE.md b/RELEASE.md index 21ae08b..12e52e5 100644 --- a/RELEASE.md +++ b/RELEASE.md @@ -124,7 +124,7 @@ Suggested description: > Component-resolved local cross-section mechanics of dynamic power cables: > stiffness, hysteretic bending with armour slip, wire and component stresses, > contact, thermal response and fatigue at fixed material points, with readers for -> CableDyn, RIFLEX and CSV time-history results. +> CableDyn and CSV time-history results. Suggested topics: `dynamic-power-cable`, `submarine-cable`, `cross-section-analysis`, `helical-armour`, `fatigue`, `fretting`, `floating-offshore-wind`, `offshore-wind`, diff --git a/doc/api_python.rst b/doc/api_python.rst index 3edb6f6..796237d 100644 --- a/doc/api_python.rst +++ b/doc/api_python.rst @@ -60,7 +60,7 @@ Global results .. autofunction:: cablexsec.read_series_csv .. autofunction:: cablexsec.read_time_history_csv -.. autofunction:: cablexsec.read_riflex_ascii +.. autofunction:: cablexsec.read_ascii_columns .. autofunction:: cablexsec.read_cabledyn_sections .. autofunction:: cablexsec.read_cabledyn_range_graph .. autofunction:: cablexsec.read_cabledyn_lift diff --git a/doc/concepts.md b/doc/concepts.md index a7b88bd..8005bfe 100644 --- a/doc/concepts.md +++ b/doc/concepts.md @@ -384,7 +384,7 @@ The usual workflow runs in one direction: 1. Run the global analysis and write the history at the sections of interest. 2. Read each section into a `LoadCaseSeries` with `cx.read_time_history_csv`, - `cx.read_riflex_ascii`, or `cx.read_cabledyn_sections` followed by + `cx.read_ascii_columns`, or `cx.read_cabledyn_sections` followed by `.histories[name].to_load_case_series(area)`. 3. Compute the stress and damage at the fixed material points with `cx.fatigue_from_series` or `cx.compute_fatigue`. diff --git a/doc/file_formats.md b/doc/file_formats.md index 18b9361..fe48c00 100644 --- a/doc/file_formats.md +++ b/doc/file_formats.md @@ -13,7 +13,7 @@ and the rules it is checked against. | Geometry override | `load_cable(..., geometry_override=)` | (by hand) | YAML | | Time-history CSV export of a global analysis | `read_time_history_csv` | global analysis program | CSV, named columns | | CableXSec exchange CSV | `read_series_csv` | `write_series_csv` | CSV, fixed columns | -| RIFLEX ASCII time history | `read_riflex_ascii` | RIFLEX | whitespace-separated columns | +| Whitespace-column ASCII time history | `read_ascii_columns` | any program | whitespace-separated columns | | CableDyn run (driver or OpenFAST module) | `read_cabledyn_sections` | CableDyn | CableDyn output files and deck | | CableDyn range graph (`.Line.range.out`) | `read_cabledyn_range_graph` | CableDyn | TAB-separated, units row | | CableDyn VIV lift (`.Line.V.out`) | `read_cabledyn_lift` | CableDyn | TAB-separated | @@ -28,7 +28,7 @@ and the rules it is checked against. `_Pa`, `_N`, `_s`, `_1_m` (1/m), `_deg`. Angles in a cable file are in degrees; the loaded layers also give them in radians. -**Text is UTF-8.** YAML, JSON and project files are UTF-8. The CSV and RIFLEX +**Text is UTF-8.** YAML, JSON and project files are UTF-8. The CSV and ASCII-column readers accept UTF-8, with or without a byte-order mark, and Windows-1252. **A bad file stops with a named error.** A file that cannot be read as @@ -512,9 +512,9 @@ are written with full precision, so a series survives the round trip unchanged. The bundled demonstration history `validation/paper_data/global_demo/global_history_si.csv` is in this format. -### RIFLEX ASCII time history +### Whitespace-column ASCII time history -`cx.read_riflex_ascii(path, ...)` reads whitespace-separated columns, one row +`cx.read_ascii_columns(path, ...)` reads whitespace-separated columns, one row per sample. Lines starting with `#`, `%` or `!` and blank lines are skipped. Columns are selected by their 1-based position, not by name: diff --git a/doc/global_local_guide.md b/doc/global_local_guide.md index c05f6d1..cea66ff 100644 --- a/doc/global_local_guide.md +++ b/doc/global_local_guide.md @@ -244,7 +244,7 @@ bend moments are `M = (Σf·y, −Σf·x)`, mapped to the gradient frame as sag (`(0, −0.136)`) at `θ = 0°`, as the concavity of each line requires. Earlier versions of `rotation_to_strain_curvature` returned `(k_y, −k_x)`, the negative, which put the tensile fibre half a turn from its physical place in the -time-history CSV, CableDyn and RIFLEX-rotation paths. The probe numbers are in +time-history CSV, CableDyn and ASCII-column rotation paths. The probe numbers are in `tests/data/curvature_sign_probe.json` (`tests/test_curvature_sign_probe.py`; no global solver is needed to run it), and the CableDyn gates in `tests/test_cabledyn_reader.py` check that the diff --git a/doc/glossary.rst b/doc/glossary.rst index 861a9a4..24a77b7 100644 --- a/doc/glossary.rst +++ b/doc/glossary.rst @@ -942,11 +942,6 @@ Terms and abbreviations A clamping basis or cable label for a value chosen to be typical, not taken from a particular cable, for example the 2.0 MPa ``P0`` of the 33 kV templates. - RIFLEX - A global analysis program for slender marine structures. :func:`~cablexsec.read_riflex_ascii` - reads its ASCII time histories, with positional columns and a declared tension kind and - curvature convention. - rig test A combined tension and cyclic bending test of a specimen clamped at both ends. :func:`~cablexsec.simulate_rig_test` predicts the armour strain-gauge readings, including diff --git a/doc/howto.md b/doc/howto.md index 6af1a10..94aa4ed 100644 --- a/doc/howto.md +++ b/doc/howto.md @@ -303,10 +303,10 @@ exceeds one even at the reference temperature. ## Global analysis results -### Reading CableDyn and RIFLEX results +### Reading CableDyn results and ASCII column files -**Goal:** load series at named sections of a CableDyn run and from a RIFLEX -ASCII time history. +**Goal:** load series at named sections of a CableDyn run and from a +whitespace-column ASCII time history. ```{literalinclude} howto/scripts/howto_10_read_global_results.py :language: python @@ -318,12 +318,12 @@ ASCII time history. 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.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 +columns 240 samples, 59.8 s, effective tension 65.25 kN mean, kappa_x -0.0155 to 0.0156 1/m ``` The true wall force is the {term}`effective tension` less the hydrostatic pressure times the outer area. At the sag bend it is compressive while the effective -tension is positive. RIFLEX columns are positional, so declare the tension +tension is positive. ASCII columns are positional, so declare the tension kind and the curvature convention, and convert effective tension with `with_true_tension` before fatigue. The [global–local guide](global_local_guide.md) covers both readers. diff --git a/doc/howto/scripts/howto_10_read_global_results.py b/doc/howto/scripts/howto_10_read_global_results.py index 123c62a..8b55746 100644 --- a/doc/howto/scripts/howto_10_read_global_results.py +++ b/doc/howto/scripts/howto_10_read_global_results.py @@ -1,6 +1,6 @@ # SPDX-License-Identifier: Apache-2.0 # Copyright (c) 2026 Jae Hoon Seo, SMI Lab, Inha University -"""How-to 10: read CableDyn and RIFLEX ASCII results into load series. +"""How-to 10: read CableDyn results and an ASCII column file into load series. Uses the files under ``tests/data`` of a source checkout: @@ -36,9 +36,9 @@ f"|kappa| max {np.hypot(kx, ky).max():.4f} 1/m" ) -# RIFLEX ASCII: positional columns; declare the tension and curvature basis. -series = cx.read_riflex_ascii( - DATA / "histories" / "synthetic_riflex.asc", +# Whitespace-column ASCII: positional columns; declare the tension and curvature basis. +series = cx.read_ascii_columns( + DATA / "histories" / "synthetic_columns.asc", time_col=1, curvature_x_col=2, tension_col=3, @@ -47,7 +47,7 @@ curvature_convention="strain_gradient", ) print( - f"riflex {series.time_s.size} samples, {series.time_s[-1]:.1f} s, " + f"columns {series.time_s.size} samples, {series.time_s[-1]:.1f} s, " f"{series.tension_kind} tension {series.tension_N.mean() / 1e3:.2f} kN mean, " f"kappa_x {series.curvature_x_1_m.min():.4f} to " f"{series.curvature_x_1_m.max():.4f} 1/m" diff --git a/doc/index.rst b/doc/index.rst index 7f11621..04f1182 100644 --- a/doc/index.rst +++ b/doc/index.rst @@ -8,7 +8,7 @@ Python library for the local (cross-section) mechanics of dynamic power cables. definition and a section load history it computes the axial, torsional and bending stiffness, the hysteretic moment–curvature response of helical armour with frictional slip, the stresses of every wire and component at fixed material points, contact pressures and slip, temperatures, -and fatigue damage. It reads the results of global analyses (CableDyn, RIFLEX, CSV exports) and +and fatigue damage. It reads the results of global analyses (CableDyn, CSV and whitespace-column exports) and turns them into the fatigue damage of the armour, the conductor and the metallic sheaths. .. admonition:: Release status @@ -60,7 +60,7 @@ What CableXSec computes through SWT, steel with a user-registered slip-amplitude curve); long-term damage over a scatter of sea states; termination-adjusted fatigue * - Global to local - - readers for CableDyn, RIFLEX and CSV time-history results; the ``cablexsec-batch`` command; + - readers for CableDyn, CSV and whitespace-column time-history results; the ``cablexsec-batch`` command; hysteretic bending-law export for global analysis Learning path diff --git a/doc/local_analysis_guide.md b/doc/local_analysis_guide.md index 43a2be8..22cc2cd 100644 --- a/doc/local_analysis_guide.md +++ b/doc/local_analysis_guide.md @@ -100,6 +100,14 @@ verification gates and active limitations. Read it. screens, which 4.1.2.2.4 treats as belted. (The SL-type route, with the filler geometric factor, and transient heat transfer through the IEC 60287 ladder are available, Section 7.3.) +- Accuracy of the single-core-equivalent ladder for three-core cables. IEC + 60287 treats a three-core cable as one radial (1-D) ladder with isothermal + sheaths. Against 2-D finite-element models at constant losses, + Chatzipetros and Pilgrim (2018, IEEE Trans. Power Delivery 33(4), + doi:10.1109/TPWRD.2017.2770321) found that it underestimates the conductor temperature by up to 8 °C for + SL-type lead-sheathed cables (Table I) and by 4.9 to 5.9 °C for cables with + aluminium or copper foil screens (Table II). The ladder here follows IEC and + inherits this error; their modified geometric factors are not implemented. - The slip-branch bending stiffness of a compact, solid-filler three-core cable (known limitation, gap G8; [benchmarks.md](benchmarks.md), "Known limitation: slip-branch stiffness of compact sections"). @@ -369,7 +377,7 @@ read-only snapshots; edit with `dataclasses.replace`. curvature (k_x, k_y), fibre strain `k_x*y - k_y*x` (checked against a global line model: a hogging cantilever root, (0, +k), is in tension at φ = 180°, a sag bend, (0, −k), at φ = 0). The readers (`read_time_history_csv`, - CableDyn `strain_gradient()`, RIFLEX + CableDyn `strain_gradient()`, `read_ascii_columns` `curvature_convention="rotation"`) convert it to the gradient `(-y curvature, x curvature)`; bend moments map to `(-M_y, M_x)` (`cablexsec.mechanics.section_conventions`). `curvature_map="paper_r2"` @@ -399,7 +407,7 @@ Readers: | Function | Source | Notes | | --- | --- | --- | | `read_time_history_csv(path, ...)` | Time-history CSV export | Whole words of the heading, case-insensitive, exact heading first; must match one column; magnitude headings refused for curvature; row length checked. Defaults: `x curvature`, `y curvature`, `Wall tension` (kN, scale 1e3), strain in percent (scale 0.01) | -| `read_riflex_ascii(path, ...)` | RIFLEX ASCII | Positional columns; declare `tension_kind` and `curvature_convention` | +| `read_ascii_columns(path, ...)` | Whitespace-column ASCII | Positional columns; declare `tension_kind` and `curvature_convention` | | `read_cabledyn_sections(out_root, deck, sections, ...)` | CableDyn driver or OpenFAST module files | Returns `CableDynSectionHistory` per section; curvature vector reconstructed from tangent channels or positions; `.to_load_case_series(A_o)` gives the true-force series | | `read_series_csv` / `write_series_csv` | Canonical CSV | Round trip preserves kinds | | `jonswap_series(...)` | Synthetic | For demonstrations and tests only | @@ -1300,8 +1308,10 @@ in IEC), and the dielectric loss from the `U0` of the insulation's as CIGRE TB 880 does; a metal tape over the wires is left out (TB 880 Guidance Point 29). A single-core cable gets no proximity or sheath loss (they depend on the circuit): pass `y_p` and `lambda1`. `result.losses` holds the -values used and the provenance their basis. The section state applies each layer's free -thermal strain and the registered polymer E(T) laws within their source +values used and the provenance their basis. The ladder is the IEC +single-core-equivalent model, which can read a three-core cable's conductor +temperature up to 8 °C low (Chatzipetros and Pilgrim 2018; Section 2). The +section state applies each layer's free thermal strain and the registered polymer E(T) laws within their source ranges, with one temperature per annulus; `temperature_C=` (a value or a mapping covering every layer) replaces the profile. On this path `sigma_A_Pa` already contains the thermal stress and `sigma_T_Pa` is zero. Do not combine it @@ -1543,7 +1553,7 @@ strain-life route (`method="strain_life"`, Section 13.3) accepts it. ### 8.1 Capacity check of global time series -A global history (time-history CSV, RIFLEX or CableDyn) is placed sample by sample on +A global history (time-history CSV, ASCII columns or CableDyn) is placed sample by sample on the tension–curvature envelope: a utilisation time series against the capacity curve and its statistical extreme (utilisation levels as in Skeie et al. 2012, Fig. 11). diff --git a/doc/user_guide.md b/doc/user_guide.md index d73257c..c8eec72 100644 --- a/doc/user_guide.md +++ b/doc/user_guide.md @@ -90,7 +90,8 @@ section. The readers are: - `cx.read_time_history_csv` for a {term}`time-history CSV` export, columns selected by header; -- `cx.read_riflex_ascii` for a {term}`RIFLEX` ASCII time history; +- `cx.read_ascii_columns` for a whitespace-column ASCII time history, columns + selected by position; - `cx.read_cabledyn_sections` for a CableDyn run ([global–local guide](global_local_guide.md)); - `cx.read_series_csv` for a CableXSec series CSV. diff --git a/src/cablexsec/__init__.py b/src/cablexsec/__init__.py index adc693e..1a58aaf 100644 --- a/src/cablexsec/__init__.py +++ b/src/cablexsec/__init__.py @@ -263,10 +263,10 @@ LoadCaseSeries, fatigue_from_series, jonswap_series, + read_ascii_columns, read_cabledyn_lift, read_cabledyn_range_graph, read_cabledyn_sections, - read_riflex_ascii, read_series_csv, read_time_history_csv, write_series_csv, @@ -557,7 +557,7 @@ "LoadCaseSeries", "jonswap_series", "read_time_history_csv", - "read_riflex_ascii", + "read_ascii_columns", "read_series_csv", "write_series_csv", "fatigue_from_series", diff --git a/src/cablexsec/analysis/capacity_check.py b/src/cablexsec/analysis/capacity_check.py index de75f1d..4c704a6 100644 --- a/src/cablexsec/analysis/capacity_check.py +++ b/src/cablexsec/analysis/capacity_check.py @@ -2,7 +2,7 @@ # Copyright (c) 2026 Jae Hoon Seo, SMI Lab, Inha University r"""Capacity check of global tension-curvature time series. -A global analysis (CableDyn, RIFLEX or another program) gives the tension and the +A global analysis (CableDyn or another program) gives the tension and the curvature at a cable section. Each sample is placed on the cross-section capacity envelope and given a design utilisation; the history of that utilisation, its maximum and the time it occurs, the exceedance counts and @@ -1339,7 +1339,7 @@ def check_capacity_series( """:func:`check_capacity` of a reader output. Accepts a :class:`~cablexsec.io.series.LoadCaseSeries` (time-history CSV, - RIFLEX, canonical CSV; its ``tension_kind`` must be declared) + whitespace columns, canonical CSV; its ``tension_kind`` must be declared) or a :class:`~cablexsec.io.cabledyn.CableDynSectionHistory` (effective tension, or the true tension with ``external_area_m2``; its torque is reported). diff --git a/src/cablexsec/analysis/neutral_axis.py b/src/cablexsec/analysis/neutral_axis.py index 3de6eac..ef54b9a 100644 --- a/src/cablexsec/analysis/neutral_axis.py +++ b/src/cablexsec/analysis/neutral_axis.py @@ -8,7 +8,7 @@ (:mod:`cablexsec.mechanics.section_conventions`): the curvature is the axial-strain gradient ``b = (kx, ky)`` [1/m], so that a section point ``p = (x, y)`` has the axial strain ``eps0 + kx x + ky y``; angles are -measured from the section x axis towards y. Global-model, CableDyn and RIFLEX +measured from the section x axis towards y. Global-model and CableDyn rotation curvatures are converted to ``b`` by the readers. 1. **Bending direction** ``theta = atan2(ky, kx)``: the direction of the diff --git a/src/cablexsec/coupling.py b/src/cablexsec/coupling.py index e02d44b..ff840b5 100644 --- a/src/cablexsec/coupling.py +++ b/src/cablexsec/coupling.py @@ -2,8 +2,8 @@ # Copyright (c) 2026 Jae Hoon Seo, SMI Lab, Inha University r"""CableDyn coupling surface: the cross-section tangent stiffness. -The interface a **global Cosserat-rod / dynamic solver** (CableDyn, RIFLEX, -…) calls to get the cross-section's *curvature-dependent* tangent +The interface a **global Cosserat-rod / dynamic solver** (CableDyn or +another) calls to get the cross-section's *curvature-dependent* tangent bending stiffness at an operating point. This is the surface that makes CableXSec infrastructure other solvers build on, so it is **versioned** (:data:`COUPLING_API_VERSION`) and **contract-tested** — a downstream solver can diff --git a/src/cablexsec/io/__init__.py b/src/cablexsec/io/__init__.py index 82e3f4a..dd6bc22 100644 --- a/src/cablexsec/io/__init__.py +++ b/src/cablexsec/io/__init__.py @@ -12,7 +12,8 @@ generator so the demos/tests need no proprietary files. - :func:`~cablexsec.io.time_history_csv.read_time_history_csv` — time-history CSV export of a global analysis, columns selected by header. -- :func:`~cablexsec.io.riflex_reader.read_riflex_ascii` — RIFLEX ASCII results. +- :func:`~cablexsec.io.ascii_columns_reader.read_ascii_columns` — whitespace-column + ASCII time histories, columns selected by position. - :func:`~cablexsec.io.cabledyn.read_cabledyn_sections` — CableDyn driver and OpenFAST module outputs: section histories with reconstructed signed curvature components (doc/global_local_guide.md). @@ -28,6 +29,7 @@ from __future__ import annotations +from cablexsec.io.ascii_columns_reader import read_ascii_columns from cablexsec.io.cabledyn import ( CableDynLift, CableDynRangeGraph, @@ -42,7 +44,6 @@ read_cabledyn_station_table, series_from_curvature_components, ) -from cablexsec.io.riflex_reader import read_riflex_ascii from cablexsec.io.series import ( LoadCaseSeries, fatigue_from_series, @@ -64,7 +65,7 @@ "read_cabledyn_range_graph", "read_cabledyn_sections", "read_cabledyn_station_table", - "read_riflex_ascii", + "read_ascii_columns", "read_series_csv", "read_time_history_csv", "section_channels", diff --git a/src/cablexsec/io/riflex_reader.py b/src/cablexsec/io/ascii_columns_reader.py similarity index 85% rename from src/cablexsec/io/riflex_reader.py rename to src/cablexsec/io/ascii_columns_reader.py index 27aa548..970c5bb 100644 --- a/src/cablexsec/io/riflex_reader.py +++ b/src/cablexsec/io/ascii_columns_reader.py @@ -1,13 +1,14 @@ # SPDX-License-Identifier: Apache-2.0 # Copyright (c) 2026 Jae Hoon Seo, SMI Lab, Inha University -r"""RIFLEX ASCII results reader. +r"""Whitespace-column ASCII time-history reader. -Reads a **RIFLEX whitespace-delimited ASCII time-history** (the column dump from -a RIFLEX dynamic run: optional ``#``/``%`` comment lines, then one whitespace- -separated row per time sample) into a +Reads a **whitespace-delimited ASCII time history** (optional ``#``, ``%`` or +``!`` comment lines, then one whitespace-separated row per time sample) into a :class:`~cablexsec.io.series.LoadCaseSeries`. Columns are selected by -**1-based index** (RIFLEX ASCII dumps are positional and rarely carry a usable -header), with unit scales to convert to ``1/m`` and ``N``. +**1-based index** (column dumps are positional and rarely carry a usable +header), with unit scales to convert to ``1/m`` and ``N``. The reader assumes +no particular program's layout: the caller declares the columns, units, +tension kind and curvature convention. Like the time-history CSV reader this is gated by the L6 known-answer test against a synthetic fixture; it carries its data-origin and unit caveats in provenance. @@ -28,10 +29,10 @@ FloatArray = NDArray[np.float64] -__all__ = ["read_riflex_ascii"] +__all__ = ["read_ascii_columns"] -def read_riflex_ascii( +def read_ascii_columns( path: str | Path, *, time_col: int = 1, @@ -45,12 +46,12 @@ def read_riflex_ascii( tension_kind: Literal["true", "effective", "unspecified"] = "unspecified", curvature_convention: Literal["strain_gradient", "rotation"] = "strain_gradient", ) -> LoadCaseSeries: - r"""Read a RIFLEX ASCII time-history into a :class:`LoadCaseSeries`. + r"""Read a whitespace-column ASCII time history into a :class:`LoadCaseSeries`. Parameters ---------- path : str or pathlib.Path - RIFLEX ASCII results file. + Whitespace-column ASCII file. time_col, curvature_x_col, tension_col : int **1-based** column indices of the required quantities. curvature_y_col, temperature_col : int or None, optional @@ -75,7 +76,7 @@ def read_riflex_ascii( """ p = Path(path) if not p.is_file(): - raise FileNotFoundError(f"RIFLEX ASCII not found: {p}") + raise FileNotFoundError(f"ASCII column file not found: {p}") if curvature_convention not in ("strain_gradient", "rotation"): raise CableSchemaError("declare rotation or strain_gradient curvature") @@ -140,7 +141,7 @@ def read_riflex_ascii( tension_kind=tension_kind, source=p.name, provenance=Provenance( - method="RIFLEX ASCII time-history reader (positional columns)", + method="whitespace-column ASCII time-history reader (positional columns)", citations=(), gates=( "known-answer rainflow gate vs a synthetic fixture (L6.1)", @@ -148,9 +149,9 @@ def read_riflex_ascii( ), limitations=( "positional 1-based columns — verify the *_col indices match the " - "RIFLEX dump layout", + "file layout", "column units are taken from the scale arguments (->1/m, ->N)", - "data origin is the upstream RIFLEX model", + "data origin is the upstream global model", ), ), ) diff --git a/src/cablexsec/io/synthetic.py b/src/cablexsec/io/synthetic.py index 99f4cdd..92958a5 100644 --- a/src/cablexsec/io/synthetic.py +++ b/src/cablexsec/io/synthetic.py @@ -190,7 +190,7 @@ def jonswap_series( ----- Screening generator: a representative curvature spectrum from a sea state, **not** a calibrated vessel/cable hydrodynamic response. Use a real global - analysis (time-history CSV, RIFLEX or CableDyn reader) for design fatigue. + analysis (time-history CSV, ASCII-column or CableDyn reader) for design fatigue. Dynamic tension. Every wave component that bends the cable also changes its tension (vessel heave and surge at a hang-off), with one transfer diff --git a/src/cablexsec/mechanics/section_conventions.py b/src/cablexsec/mechanics/section_conventions.py index 86d4e7d..4293c90 100644 --- a/src/cablexsec/mechanics/section_conventions.py +++ b/src/cablexsec/mechanics/section_conventions.py @@ -5,7 +5,7 @@ Convention (right-handed; checked against a global line model, 17 October 2026). The material frame (x, y, s) is right-handed, with s along the tangent t from End A to End B. Global codes (``x/y curvature`` and ``x/y bend -moment`` exports, CableDyn, a RIFLEX rotation export) report the +moment`` exports, CableDyn, a rotation column export) report the rotation-curvature vector ``kappa = t x dt/ds`` on (x, y). A fibre at (x, y) = r (cos phi, sin phi) then has axial strain:: diff --git a/tests/data/histories/synthetic_riflex.asc b/tests/data/histories/synthetic_columns.asc similarity index 99% rename from tests/data/histories/synthetic_riflex.asc rename to tests/data/histories/synthetic_columns.asc index cd59a3d..ec92b69 100644 --- a/tests/data/histories/synthetic_riflex.asc +++ b/tests/data/histories/synthetic_columns.asc @@ -1,4 +1,4 @@ -# Synthetic RIFLEX-style ASCII record for the CableXSec tests; not from a RIFLEX run. +# Synthetic whitespace-column ASCII record for the CableXSec tests. # columns: time [s], curvature x [1/m], tension [N], curvature y [1/m] 0 0 68115.3467 0.008 0.25 0.00519460298 69676.8813 0.00787846202 diff --git a/tests/test_exported_load_conventions.py b/tests/test_exported_load_conventions.py index 212faaa..a827511 100644 --- a/tests/test_exported_load_conventions.py +++ b/tests/test_exported_load_conventions.py @@ -161,9 +161,9 @@ def test_invalid_unit_multiplier_is_rejected(tmp_path, name, value): def test_positional_reader_preserves_declared_force_and_curvature_convention(tmp_path): - path = tmp_path / "riflex.asc" + path = tmp_path / "columns.asc" path.write_text("0 0.01 -0.02 20000\n1 -0.03 0.04 60000\n") - result = cx.read_riflex_ascii( + result = cx.read_ascii_columns( path, curvature_y_col=3, tension_col=4, diff --git a/tests/test_io.py b/tests/test_io.py index ecc908f..f9a7548 100644 --- a/tests/test_io.py +++ b/tests/test_io.py @@ -7,7 +7,7 @@ * a zero-curvature, constant-amplitude tension history makes σ_total = σ_A only (σ_B = σ_f = 0), so the per-wire Miner damage is closed-form; the CSV/ - RIFLEX reader path must recover it to < 1e-10; + ASCII-column reader path must recover it to < 1e-10; * write → read round-trips the canonical exchange CSV bit-for-bit, and the fatigue result through the reader equals the in-memory result exactly; * the JONSWAP generator is deterministic and hits its target RMS. @@ -151,14 +151,14 @@ def test_temperature_history_maps_into_fatigue_sigma_T() -> None: assert any("temperature_C mapped" in x for x in hot_res.provenance.limitations) -def test_riflex_reader_positional_columns(tmp_path) -> None: - """RIFLEX positional ASCII reads back the exact arrays (with comments).""" - asc = tmp_path / "riflex.asc" - rows = ["# RIFLEX dynamic results", "# time curv_x tension"] +def test_ascii_columns_reader_positional_columns(tmp_path) -> None: + """Positional whitespace-column ASCII reads back the exact arrays (with comments).""" + asc = tmp_path / "columns.asc" + rows = ["# dynamic results", "# time curv_x tension"] rows += [f"{i * 0.5} {0.01 * math.sin(i * 0.2)} {1.2e5}" for i in range(40)] asc.write_text("\n".join(rows), encoding="utf-8") - ser = cx.read_riflex_ascii(asc, time_col=1, curvature_x_col=2, tension_col=3) + ser = cx.read_ascii_columns(asc, time_col=1, curvature_x_col=2, tension_col=3) assert ser.n_steps == 40 assert ser.tension_N[0] == pytest.approx(1.2e5) assert ser.curvature_x_1_m[10] == pytest.approx(0.01 * math.sin(10 * 0.2)) diff --git a/tests/test_reader_release_boundaries.py b/tests/test_reader_release_boundaries.py index e2ace50..ab729eb 100644 --- a/tests/test_reader_release_boundaries.py +++ b/tests/test_reader_release_boundaries.py @@ -9,7 +9,7 @@ @pytest.mark.parametrize( - "reader", [cx.read_time_history_csv, cx.read_riflex_ascii, cx.read_series_csv] + "reader", [cx.read_time_history_csv, cx.read_ascii_columns, cx.read_series_csv] ) def test_missing_exchange_file(reader, tmp_path): with pytest.raises(FileNotFoundError): @@ -57,11 +57,11 @@ def test_bad_time_history_csv(tmp_path, body, kwargs, match): ("0 0 1\n", {"curvature_convention": "bad"}, "declare"), ], ) -def test_bad_riflex_ascii(tmp_path, body, kwargs, match): +def test_bad_ascii_columns(tmp_path, body, kwargs, match): path = tmp_path / "export.txt" path.write_text(body) with pytest.raises(cx.CableSchemaError, match=match): - cx.read_riflex_ascii(path, **kwargs) + cx.read_ascii_columns(path, **kwargs) _HEADER = "Time,x curvature,y curvature,Wall tension" @@ -119,14 +119,14 @@ def test_series_csv_accepts_byte_order_mark_and_refuses_repeated_columns(tmp_pat ({"tension_col": 2.0}, "1-based integers"), ], ) -def test_riflex_column_indices_checked_before_reading(tmp_path, kwargs, match): - path = tmp_path / "riflex.asc" +def test_ascii_column_indices_checked_before_reading(tmp_path, kwargs, match): + path = tmp_path / "columns.asc" path.write_text("0.0 0.01 5e4\n0.1 0.02 5e4\n") with pytest.raises(cx.CableSchemaError, match=match): - cx.read_riflex_ascii(path, **kwargs) + cx.read_ascii_columns(path, **kwargs) -def test_riflex_reads_windows_1252_comment(tmp_path): - path = tmp_path / "riflex.asc" +def test_ascii_columns_reads_windows_1252_comment(tmp_path): + path = tmp_path / "columns.asc" path.write_bytes("# angle (\xb0)\n0.0 0.01 5e4\n0.1 0.02 5e4\n".encode("cp1252")) - np.testing.assert_allclose(cx.read_riflex_ascii(path).time_s, [0.0, 0.1]) + np.testing.assert_allclose(cx.read_ascii_columns(path).time_s, [0.0, 0.1])