Skip to content

fix: TMax = 0 static checks, faster elevation-record waves, WvHiCOff - #64

Merged
SMI-Lab-Inha merged 4 commits into
devfrom
feat/inputs-speed
Oct 29, 2026
Merged

SMI-Lab-Inha merged 4 commits into
devfrom
feat/inputs-speed

Conversation

@SMI-Lab-Inha

Copy link
Copy Markdown
Owner

Three fixes from a user's digital-twin feedback, in one PR. Each is a separate commit: the static check of a dynamic deck, the speed of elevation-record waves, and their high cut-off.

1. TMax = 0 checks the static start of any dynamic deck

Checking the static start of a dynamic deck meant cutting the deck down first.

  • Motion records may outlast TMax. This covers motionFile point rows, TURBINES rows and vesselMotion. Rows after TMax are still parsed and placed on the dtM grid, then not used; off-grid rows are still refused. A shared helper, motion_grid_index, replaces three copies of the grid lookup.
  • RangeStart at TMax = 0 is accepted, and the range graphs hold the t = 0 row. After a TMax > 0 it is still refused.
  • A pointer in the message. A standalone deck without TMax whose error asks for a dynamic run now ends with ; to check a dynamic deck's static start only, give dtM with TMax = 0. The Python validator gives the same text.
  • Checks:
    • New static_check test: a 1 s run on a 36 s record writes byte-identical output to a run on the record cut to 1 s.
    • shared_anchor: a TURBINES record longer than the run gives the same run, bit for bit.

2. Faster elevation-record waves

A WaterKin WaveKinMod 1 record becomes about TMax/(2 dtWave) Fourier components, which every node summed. The JONSWAP option has 200.

  • Tail bound. CD_Component_Wave_Kinematics gains an optional tail_sums table, for tables whose k does not decrease.

    • Below the surface, both depth ratios fall as k grows. So the last summed component's cosh ratio, times the remaining sums of a ω, a ω² and a ω²/k, bounds the rest of the velocity, acceleration and pressure sums.
    • The sums stop once that bound is below half an ulp of what has been summed. The elevation still sums every component.
    • The sums run in blocks of 32, in component order. Without tail_sums the result is bit for bit the same.
    • The underflow fallback reuses each block's exponentials.
    • The deck driver builds the table, and the exp(-2kd) cache, for elevation records and JONSWAP.
  • WaveKinFile reading. The file was read one row at a time, copying the whole record per row. The rows now grow by doubling.

  • Measured on a 1024-element lazy-wave cable over 300 s:

    Case Before After
    Elevation record, dtWave 0.25 s 226 s 103 s
    Elevation record, dtWave 0.1 s about 660 s 189 s
    10 s run on a 168,000-row record 107 s 3.5 s

    Both elevation decks give output identical to the printed digits. The JONSWAP run changes in its eighth printed digit.

  • New kernel test in hermite_irregular_waves: a 1500-component table, from the surface to the seabed, with and without stretching.

    • The elevation is bit-identical.
    • Velocity, acceleration and pressure agree within 4 ulp of the summed magnitudes.

3. WvHiCOff: high cut-off of an elevation record, 0.5 Hz by default

  • The option. WvHiCOff (rad/s, SeaState's name and meaning) drops the record's components above it. The default is π rad/s, the 0.5 Hz at which MoorDyn-C cuts WaveKin 3.
    • WaveKin 3 now follows the option too, bit for bit at the default.
    • none WvHiCOff keeps every component, as MoorDyn-F and earlier CableDyn did.
    • A record with nothing at or below the cut-off is refused by name.
  • Effect. A one-hour record at dtWave 0.1 s drops from 18,000 components to 1,800. On the 300 s case both records then run in 72 s. Every output channel's standard deviation moves by at most 0.002 %.
  • TMax = 0. A WaveKinMod 1 deck at TMax = 0 now reduces its record over the record's own length, instead of failing for want of a positive TMax.
  • Checks:
    • wavekin_modes: 1 rad/s keeps only the record's 8 s harmonic, exactly; none reproduces the record.
    • deck_driver: the refusal, and the TMax = 0 run.
    • The Python validator accepts WvHiCOff, and refuses 0 and text other than none.

Checks

  • Test suite: ctest 311/311; Python 2031 passed.
  • Examples against dev: 50 of 52 are byte-identical. The other two are JONSWAP decks, which change at round-off:
    • lazy_wave_bend_stiffener changes in its eighth printed digit.
    • lazy_wave_vessel_rao has one step, at 46.8 s, that converges one iteration apart under its 1e-4 solver tolerance. That moves FairTen by 1.5 N (1.7e-4) for half a second. At a 1e-9 tolerance, old and new agree to the last printed digit.
  • Format: fprettify, ruff and Sphinx are clean.

Signed-off-by: Jae Hoon Seo jaehoon.seo@inha.ac.kr

Checking the static start of a dynamic deck meant editing it down: with
dtM and TMax removed, the deck stopped on its first dynamic input with a
message about a dynamic run, and with TMax = 0 a RangeStart or a motion
record longer than the run was refused. Now:

- motionFile (point and TURBINES rows) and vesselMotion records may run
  past TMax. Rows after TMax are parsed, range-checked and placed on the
  dtM grid (to 100 eps max(1, t)), and are not used, so a long record
  also serves a shorter run. Off-grid rows and rows before 0 are still
  refused.
- RangeStart is accepted at TMax = 0, where the range graphs hold the
  t = 0 row; after a TMax > 0 it is still refused.
- A standalone deck without TMax whose error asks for dtM and TMax (or
  for a dynamic deck) ends with "to check a dynamic deck's static start
  only, give dtM with TMax = 0", in the driver and in the Python deck
  validator.

Every shipped dynamic example runs at TMax = 0. On both shipped
motion-record decks, a 1 s run on the 36 s record writes the same output,
byte for byte, as one on the record cut to 1 s (static_check). A
TURBINES record 2 s longer than TMax gives the same run (shared_anchor).

Signed-off-by: Jae Hoon Seo <jaehoon.seo@inha.ac.kr>
A WaterKin elevation history (WaveKinMod 1) is reduced to about
TMax/(2 dtWave) Fourier components, up to the Nyquist frequency of
dtWave: 600 for a 300 s run at 0.25 s, against the 200 of a jonswap sea.
Every node summed all of them with a cos, a sin and two exps each, so a
lazy-wave cable ran 2.9 times slower than with the jonswap option.

CD_Component_Wave_Kinematics takes an optional tail_sums table: the sums
over j >= i of a_j omega_j, a_j omega_j^2 and a_j omega_j^2/k_j, for a
table whose k does not decrease. On -depth <= z' <= 0 both depth ratios
fall as k grows, so the cosh ratio of the last summed component times the
tail sums bounds the rest of the velocity, acceleration and pressure
sums; they stop once that bound is below half an ulp of the magnitude
already summed. The elevation still sums every component. The sums run
in blocks of 32 in component order, so without tail_sums the result is
bit for bit the same, and the underflow fallback reuses the block's
exponentials instead of recomputing two per component.

The deck driver builds the table, and the exp(-2kd) table it already
kept for jonswap, for the elevation-history components and for jonswap.
On a 1024-element lazy-wave cable over 300 s, a record at dtWave 0.25 s
runs in 103 s instead of 226 s and one at 0.1 s in 189 s instead of
about 660 s, with output identical to the printed digits; the jonswap
run changes in its eighth printed digit.

Reading the WaveKinFile appended one row at a time, copying the whole
record per row: a 10 s run on a 168,000-row record took 107 s. The rows
now grow by doubling, and the same run takes 3.5 s.

Signed-off-by: Jae Hoon Seo <jaehoon.seo@inha.ac.kr>
A WaterKin WaveKinMod 1 record kept every Fourier component up to the
Nyquist frequency of dtWave: 18,000 for a one-hour record at 0.1 s, each
summed at every node for the surface elevation. Measured on a user's
600 s twin case, keeping only the components up to 0.5 Hz changed the
curvature fatigue load by 0.02 % and cut the wave time by 8.5 times.

The new OPTION WvHiCOff (rad/s, SeaState's name and meaning) drops the
components of an elevation record above it, by default pi rad/s, the
0.5 Hz at which MoorDyn-C cuts WaveKin 3; WaveKin 3 now follows the
option too (bit for bit at the default). none WvHiCOff keeps every
component, as MoorDyn-F and earlier CableDyn did. A record with no
component at or below the cut-off (a run shorter than 2 s at the
default) is refused by name. The WaveKin 3 components are stored in
preallocated arrays instead of growing by one per component.

On the 300 s lazy-wave case (1024 elements), records at dtWave 0.25 s
and 0.1 s both run in 72 s (103 s and 189 s with none), and every output
channel's standard deviation moves by at most 0.002 %.

Signed-off-by: Jae Hoon Seo <jaehoon.seo@inha.ac.kr>
A WaterKin WaveKinMod 1 deck sizes its Fourier window from TMax, as
MoorDyn-F does, and refused TMax = 0, the check of a dynamic deck's
static start. At TMax = 0 the window is now the record's own length.

Signed-off-by: Jae Hoon Seo <jaehoon.seo@inha.ac.kr>
@SMI-Lab-Inha

Copy link
Copy Markdown
Owner Author

@codex review

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 29, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-29T03:31:03.845578Z b891e55 Manual request
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@read-the-docs-community

Copy link
Copy Markdown

Documentation build overview

📚 CableDyn | 🛠️ Build #35488680 | 📁 Comparing b891e55 against latest (fd1936d)

  🔍 Preview build  

25 files changed · ± 25 modified

± Modified

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Already looking forward to the next diff.

Reviewed commit: b891e55926

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@SMI-Lab-Inha
SMI-Lab-Inha merged commit ca381d7 into dev Oct 29, 2026
21 checks passed
@SMI-Lab-Inha
SMI-Lab-Inha deleted the feat/inputs-speed branch October 29, 2026 05:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant