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
35 changes: 35 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,41 @@ All notable changes to CableXSec are recorded in this file. The format follows

## [Unreleased]

### Added

- Global-analysis provenance (`cablexsec.io.global_provenance`): every set of global histories
carries a `GlobalProvenance` record of the run that produced it: the global solver (CableDyn
with its version and host program, or a declared program such as `OrcaFlex 11.6e`), the wave
route (`seastate_grid`, `seastate_spectral`, `deck` or `none`), the fingerprint of the wave
components (which identifies the sea where a coupled run records no seed), the seed and input
file of a standalone run, and per line the nodes outside the wave-kinematics grid, the grid
resolution flags and the spectrally weighted velocity ratio. `read_cabledyn_sections` reads it
from CableDyn's provenance file (schema `cabledyn.provenance/1`, checked field by field;
another version is refused by name, and an unfinished run warns with `UnfinishedRunWarning`),
or from the wave-grid messages of the run log (`log=`, `read_cabledyn_log`). The file is found
beside each CableDyn result file (`x.CD.out` -> `x.CD.provenance.json`, `x.FarmCD.out` ->
`x.FarmCD.provenance.json`, `x.out` -> `x.CD.provenance.json`); a run with status `init` or
`stopped` warns and keeps its record. The record, with the analysed line, travels with
`CableDynRead.provenance`, every `CableDynSectionHistory`, the `LoadCaseSeries` of every reader
(`global_provenance=`), the exchange CSV (a `# global_provenance:` comment line), project files
and the provenance of `fatigue_from_series`.
- Wave-grid policy for the analysed line (`check_wave_kinematics`): a line whose record shows
nodes outside the wave grid with a spectrally weighted velocity ratio above
`wave_grid_tolerance` (default 0.01; any node outside when the ratio is not recorded), or any
grid resolution finding (it concerns every line in the water), is refused with
`WaveKinematicsError` (`wave_grid_check="error"`, the default) or warned about with
`WaveKinematicsWarning` (`"warn"`). Nodes of other lines outside
the grid pass without a warning and are recorded. A missing record never fails a read: its
fields are recorded as unknown.
- `read_cabledyn_sections` reads FAST.Farm's CableDyn table `<root>.FarmCD.out` (with
`<root>.FarmCD.static.out` and its range file), which has the `.CD.out` layout, on the host's
clock; `checks["route"]` names it. A root with both a `.CD.out` and a `.FarmCD.out` is refused.
- Sea-state batch: `SeaStateBatchOptions.wave_grid_check` and `wave_grid_tolerance`,
`SeaStateRun.log` (run key `log` in JSON); the manifest writes each run's record
(`runs[i].global_provenance`) and policy outcome (`runs[i].checks.wave_kinematics`), and names
the runs without a record once in `notes`, which `cablexsec-batch` prints. The options and the
record do not enter `inputs_sha256` or the assessment digests.

## [0.2.2] - 2026-12-01

The Python interfaces are versioned but may change before `1.0.0`. The evidence for
Expand Down
17 changes: 17 additions & 0 deletions doc/api_python.rst
Original file line number Diff line number Diff line change
Expand Up @@ -65,3 +65,20 @@ Global results
.. autofunction:: cablexsec.read_cabledyn_range_graph
.. autofunction:: cablexsec.read_cabledyn_lift
.. autofunction:: cablexsec.run_sea_state_batch

Global-analysis provenance
--------------------------

.. automodule:: cablexsec.io.global_provenance
:no-members:

.. autoclass:: cablexsec.GlobalProvenance
:members: summary, to_record, from_record, line, unknown_fields, known, wave_route,
all_resolution_findings
.. autofunction:: cablexsec.read_cabledyn_provenance
.. autofunction:: cablexsec.read_cabledyn_log
.. autofunction:: cablexsec.check_wave_kinematics
.. autoclass:: cablexsec.io.global_provenance.WaveKinematicsAssessment
.. autoclass:: cablexsec.WaveKinematicsWarning
.. autoclass:: cablexsec.UnfinishedRunWarning
.. autoclass:: cablexsec.WaveKinematicsError
9 changes: 6 additions & 3 deletions doc/cli.rst
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,16 @@ Computes the weighted annual armour damage from a set of CableDyn sea-state runs
shipped with the package), the CableDyn runs with their probabilities and retained windows,
the material sections and the options; :func:`cablexsec.analysis.sea_state_batch.load_batch_spec`
documents every key. The output directory must not exist. It receives ``manifest.json`` (input
digests, checks, options and results), the annual fixed-fibre damage of every section and the
section history of every run. ``--workers`` overrides the number of worker processes of the
digests, checks, options, the provenance of every run and results), the annual fixed-fibre
damage of every section and the section history of every run. ``--workers`` overrides the number of worker processes of the
specification; each worker runs with one thread (``OMP_NUM_THREADS`` and the related variables
default to ``1``).

The console prints one line per section with the arc length, the annual damage, the life in
years and the critical layer, followed by the SHA-256 digest of the inputs. The
years and the critical layer, then a ``note:`` line naming the runs whose global-analysis
provenance is unknown (no CableDyn provenance file and no run log), if any, and the SHA-256
digest of the inputs. A run whose line had wave kinematics outside the wave grid stops the batch
or warns, as ``wave_grid_check`` in the options sets (:doc:`global_local_guide`, Section 3.1). The
:doc:`global_local_guide` explains the specification, the sign conventions of the CableDyn
section tables and the interpretation of the results.

Expand Down
96 changes: 92 additions & 4 deletions doc/file_formats.md
Original file line number Diff line number Diff line change
Expand Up @@ -407,6 +407,7 @@ Every reader returns a `LoadCaseSeries`, the history of one cable section:
| `axial_strain`, `axial_strain_kind` | – | optional strain; `direct`, `total` or `unspecified` |
| `temperature_C` | °C | optional; `None` for an isothermal record |
| `source`, `provenance` | – | where the record came from |
| `global_provenance` | – | how the global run was made (solver, wave route, per-line wave-grid findings; below) |

The arrays are read-only copies. `dataclasses.replace` makes an edited series.

Expand Down Expand Up @@ -509,7 +510,11 @@ reads, a fixed layout that keeps every kind:

The first three columns and exactly one tension column are required. Values
are written with full precision, so a series survives the round trip
unchanged. The bundled demonstration history
unchanged. A series that carries a global-analysis provenance record (below)
writes it first, as one comment line `# global_provenance: {...}` (the JSON
form of the record), which `read_series_csv` restores; a series without one,
or with one that records nothing (an export that names no solver), writes the
table alone. The bundled demonstration history
`validation/paper_data/global_demo/global_history_si.csv` is in this format.

### Whitespace-column ASCII time history
Expand All @@ -535,7 +540,8 @@ Driver and OpenFAST module runs write CableDyn 0.1.x output.
`cx.read_cabledyn_sections(out_root, deck, {"name": arc_length_m, ...})` reads
the output files of one run together with the deck: `<root>.out`,
`<root>.Line<L>.p.out`, `<root>.Line<L>.t.out`, `<root>.static.out` and
`<root>.elements.out`, or `<root>.CD.out` from OpenFAST. It rebuilds the
`<root>.elements.out`, or `<root>.CD.out` from OpenFAST (`<root>.FarmCD.out`
from FAST.Farm, the same layout). It rebuilds the
signed curvature vector of each named section from the tangent channels or
node positions. It returns a `CableDynSectionHistory` per section with the
effective tension, rotation curvature components, hydrostatic pressure,
Expand Down Expand Up @@ -572,6 +578,83 @@ from CableDyn's section `x` axis. `right_handed=False` reverses `y` for a
left-handed triad. `cablexsec.io.series_from_curvature_components` builds the
same series from arrays.

### Global-analysis provenance

Every reader attaches a `GlobalProvenance` record
(`cablexsec.io.global_provenance`) to what it returns. For a CableDyn run it
reads the record CableDyn writes beside its result file, named after the
result file without `.out` (`provenance_sidecar`):

| Result file | Record |
| --- | --- |
| `x.CD.out` (OpenFAST) | `x.CD.provenance.json` |
| `x.FarmCD.out` (FAST.Farm) | `x.FarmCD.provenance.json` |
| `x.out` (standalone driver) | `x.CD.provenance.json` |

Schema version 1:

```json
{
"schema": "cabledyn.provenance/1",
"cabledyn_version": "0.4.4",
"host": "openfast",
"host_version": "4.1.2",
"waves": {"route": "seastate_grid", "wave_mod": 2, "wave_seed": null,
"component_fingerprint": "9f3c2a71b4e05d18",
"wave_hs": null, "wave_tp": null, "wave_dir_deg": 30.0, "wave_dir_mod": 0,
"n_components": 2400, "wave_dt": 0.2, "wave_tmax": 3600.0,
"effective_water_depth": 200.0, "wave_kin_tol": null,
"source_file": null},
"grid": {"nx": 40, "ny": 40, "nz": 16, "x_half_width": 250.0,
"y_half_width": 250.0, "z_depth": 120.0, "wave_grid_check": "error"},
"lines": [{"id": 1, "n_nodes": 101, "out_of_grid": null, "resolution_flags": [],
"dropped_velocity_variance_max": null,
"dropped_acceleration_variance_max": null}],
"status": "complete",
"restarted_from": null
}
```

| Key | Values |
| --- | --- |
| `schema` | `cabledyn.provenance/1`; another version or schema is refused by name |
| `host` | `openfast`, `fast.farm`, `standalone` or `capi` |
| `waves.route` | `seastate_grid`, `seastate_spectral`, `deck` or `none` |
| `waves.wave_seed` | a list of integers or strings (`RANLUX`); `null` in a coupled run, as are `wave_hs`, `wave_tp` and `source_file` (SeaState does not pass them on); a standalone run gives what its deck has |
| `waves.component_fingerprint` | 16 hexadecimal digits, the 64-bit FNV-1a hash of the wave components: equal fingerprints mean the same sea; `null` for still water and `WaveMod` 6. Where the seed is `null` it is the identity of the sea in reports |
| `grid` | `null`, or the grid with `wave_grid_check` `error` or `warn` |
| `lines[].out_of_grid` | `null`, or `n_nodes_max`, `first_time` [s], `deepest_xyz` and `shallowest_xyz` [m], `weighted_velocity_ratio_max` |
| `lines[].out_of_grid` points | a coordinate may be `null` |
| `lines[].resolution_flags` | a list of strings |
| `status` | `complete`; `init` for a run that did not finish, `stopped` for one that ended on an error (both read with an `UnfinishedRunWarning`; the record is kept) |
| `restarted_from` | the time [s] of the checkpoint the run restarted from, or `null` |

Any field may be `null`, which records it as unknown. A defined field of
another type, or an enumerated field with another value, is refused with its
path named (`record.lines[0].n_nodes`); keys the schema does not define are
ignored. A record that is not UTF-8 is read as Windows-1252 (else Latin-1),
with a note. Without the file, `read_cabledyn_sections(..., log=...)` reads the
wave-grid messages of the run log instead (`read_cabledyn_log`), and without
either the record holds only what the result file's name shows (CableDyn
and its host). An exported
history records no wave route: `read_time_history_csv`, `read_ascii_columns`
and `read_cabledyn_station_table` take `global_provenance="OrcaFlex 11.6e"`
(or a `GlobalProvenance`) to declare the program, and the last two read a
comment line that names it (the solver named first, when a line names
two).

`record.to_record()` gives the JSON form written to the batch manifest and the
exchange CSV, with the record's `origin` (`sidecar`, `log`, `declared`,
`output` or `none`), the file read and its SHA-256, the analysed line
(`analysed_line`), the grid resolution findings a log states
(`resolution_findings`), and the list `unknown` of the key fields it does not
give; `GlobalProvenance.from_record` rebuilds the record. Project files save a
series with its record; a series without one is saved as before, so saved
analyses keep their fingerprints. The wave-grid policy for the analysed line
([global–local guide](global_local_guide.md) Section 3.1) is
`check_wave_kinematics(record, line_id, wave_grid_check="error",
wave_grid_tolerance=0.01)`.

### Synthetic records

`cx.jonswap_series(...)` generates a record whose curvature has the shape of a
Expand All @@ -587,14 +670,19 @@ object with four keys:
| Key | Content |
| --- | --- |
| `cable` | a YAML path, or `bundled:<file stem>` for a bundled cable such as `bundled:iea_task49_66kv` |
| `runs` | `name`, `out_root`, `deck`, `probability`; optional `line_id`, `start_time_s`, `end_time_s` |
| `runs` | `name`, `out_root`, `deck`, `probability`; optional `line_id`, `start_time_s`, `end_time_s`, `hang_off_rotation`, `log` (the run log, read for CableDyn's wave-grid messages when there is no provenance file) |
| `sections` | `name`, `arc_length_m`; optional `termination` (the fields of `TerminationSpec`, for example `distance_m` and `k_anchor_N_m`; a record without `k_anchor_N_m` has a rigid anchor), `thermal`, `fretting`, `sn_curves`, `mean_stress`, `scf` |
| `options` | the fields of `SeaStateBatchOptions` |

Relative paths are resolved against the folder of the JSON file, and unknown
keys are rejected. The output folder receives `manifest.json`, with the
SHA-256 digests of every input, the options, checks and results, together
with `<section>_annual_damage.npz` and `<section>_<run>_history.npz`.
with `<section>_annual_damage.npz` and `<section>_<run>_history.npz`. In the
manifest, `runs[i].global_provenance` is the run's provenance record (above),
`runs[i].checks.wave_kinematics` the wave-grid policy outcome for the run's
line (`status` `pass`, `affected` or `unknown`, `reasons`, `notes`,
`other_lines_affected`), `wave_grid_check` the policy options, and `notes`
names, once, the runs whose provenance is unknown.
Section 3 of the [global–local guide](global_local_guide.md) gives an
example.

Expand Down
Loading