Skip to content

fix: stop a coupled run whose SeaState grid misses its line nodes - #193

Merged
SMI-Lab-Inha merged 3 commits into
devfrom
fix/wave-grid-guard
Dec 2, 2026
Merged

SMI-Lab-Inha merged 3 commits into
devfrom
fix/wave-grid-guard

Conversation

@SMI-Lab-Inha

@SMI-Lab-Inha SMI-Lab-Inha commented Dec 2, 2026 •

Copy link
Copy Markdown
Owner

Summary

In OpenFAST, the line nodes take their wave and current kinematics from the SeaState grid. Two grid problems used to pass with at most one warning:

  • A node outside the grid. SeaState clamps it to the grid boundary, so the node gets the kinematics of the nearest boundary point: out of phase beyond a half-width, and too strong below Z_Depth.
  • A grid with two points across the direction the waves vary in. NY = 2 under waves that are not along x (or NX = 2 under waves not along y, or either under a short-crested sea) leaves three points 1 half-width apart across that axis. SeaState then interpolates across a large part of a wavelength or more, so lines and hull members between the points get the wrong amplitude and phase. Nothing warned about this.

Both now stop the run by default. A new option turns them back into one warning.

Option Values Default Effect
waveGridCheck (wave_grid_check) error, warn error error stops the run with a message naming the time and, line by line, the nodes concerned; warn warns once and runs on with SeaState's kinematics

Behaviour

  • Coverage: checked on the nodes in the water at the static start and at every CableDyn step (the same wet-node rule as the former warning: a node above the sampled free surface carries no fluid load). The message gives the time, the number of nodes outside per line with the deepest and shallowest, the farthest node per axis, and the SeaState inputs to enlarge.
  • Resolution across the waves: checked at the start from the directions of SeaState's own first-order components (WaveDirArr where WaveElevC0 is nonzero, so WaveDirMod 1 spreads and WaveMod 7 component directions are covered; For externally supplied kinematics (WaveMod 6), which have no components and for which SeaState does not use WaveDir, the supplied WaveVel and WaveAcc are compared across the three grid points of the coarse axis instead (within $10^{-5}$ of their largest magnitude). A direction counts as along an axis within $10^{-4}$ deg. NY = 2 under waves along x and NX = 2 under waves along y still run: the field does not vary across the coarse axis there.
  • Results: runs that pass both checks give the same .out and .CD.out rows, byte for byte, as dev. The grid check now uses a workspace sized at initialisation instead of allocating at every step.
  • Tutorial: the r-test MD_Shared SeaState file covers only the platform and now stops until its grid is enlarged, as doc/tutorial_openfast.rst describes. The release smoke run of that case sets waveGridCheck warn and requires the warning in its log, since it tests the executable, not line loads.

Implementation

  • src/CableDyn_WaveGrid.f90 (new): the rules as pure functions of plain numbers (direction along an axis, coarse axes for a set of component directions), so they are unit-tested without OpenFAST.
  • src/openfast/CableDyn_OF.f90: check_wavefield_grid (coverage, every step) and check_wavefield_resolution (at Init), both reporting by line; the option reaches the coupled aggregate through the deck driver.
  • Option parsing in the Fortran deck driver, the aggregate and the Python deck parser; doc/options.rst, doc/openfast.rst, doc/troubleshooting.rst, doc/tutorial_openfast.rst, examples/cabledyn_options_reference.dat, CHANGELOG.md.

Tests

  • tests/test_wave_grid.f90 (ctest wave_grid): the direction rule (both senses, tolerance edge, non-finite), coarse axes for long- and short-crested sets, the data rule for supplied kinematics (zero, along-axis, crossing, round-off, NaN, single point), and the option reaching the coupled aggregate.
  • validation/scripts/openfast_wave_grid_guard.py, against an OpenFAST build at the pinned commit: a line outside the grid, NY = 2 at 30 deg, a short-crested sea with NY = 2, and a line that leaves the grid mid-run each stop by default and run under warn; NY = 2 at 0 deg and NX = 2 at 90 deg run without a message; passing runs are byte-identical to dev.

Checks

Check Result
Fast tier ctest -L fortran -LE slow, default OpenBLAS kernel 348/348
Same, OPENBLAS_CORETYPE=Prescott 348/348
ctest -L python 54/54
Debug -fcheck=all: wave_grid, deck_driver, openfast_aggregate, openfast_aggregate_touchdown, openfast_shell 5/5
Debug -fcheck=all after the WaveMod 6 change: wave_grid, deck_driver, openfast_aggregate 3/3
openfast_wave_grid_guard.py on an OpenFAST build of this branch (incl. two WaveMod 6 cases) 13/13
Byte identity of passing runs against dev 53c9027 identical .out and .CD.out rows
fprettify, pre-commit, sphinx-build -W --keep-going, test_documentation pass

Checklist

  • pre-commit run --all-files passes
  • ctest --test-dir build --output-on-failure passes
  • python -m pytest tests python/tests passes (if Python or validation records changed)
  • VALIDATION.md updated if a validation result changed (no validation result changes)
  • CHANGELOG.md updated under [Unreleased] (heading added if missing) for user-visible changes
  • Documentation in doc/ updated for changed inputs, options, or outputs
  • Conventional Commit title (feat:, fix:, docs:, ...)
  • Commits are signed off (git commit -s) under the
    Developer Certificate of Origin

In OpenFAST, the line nodes take their wave and current kinematics from
the SeaState grid. A node outside the grid gets the kinematics of the
nearest boundary point, out of phase beyond a half-width and too strong
below Z_Depth, and CableDyn only warned once and ran on. A grid with
NX = 2 or NY = 2 (three points across that axis) under waves that vary
along the axis passed silently, although SeaState then interpolates
across a large part of a wavelength: under waves along y, a grid with
NY = 2 and a half-width near half a wavelength gives the lines between
its points nearly the kinematics of y = 0.

Both now stop the run by default. The coverage check runs at the static
start and at every CableDyn step, and its message gives the time and,
line by line, the number of nodes outside with the deepest and the
shallowest of them. The resolution check runs at the start: it reads the
directions of SeaState's wave components (the spread of WaveDirMod 1,
the component directions of WaveMod 7, WaveDir for WaveMod 6), takes a
direction as along an axis within 1e-4 deg, and stops when line nodes in
the water lie between the grid points across a coarse axis. NY = 2 under
waves along x and NX = 2 under waves along y still run. OPTIONS
waveGridCheck warn turns both into warnings; error is the default.

The rules live in a new core module, CableDyn_WaveGrid, tested without
OpenFAST (test_wave_grid, which also checks that the option reaches the
coupled aggregate). The coupled cases, which stop by default and run
with warn, and the bit-identity of runs that pass, are checked by
validation/scripts/openfast_wave_grid_guard.py against an OpenFAST
build. The release smoke case on the platform-only MD_Shared grid sets
waveGridCheck warn and requires the warning. The grid check now uses a
workspace sized at initialisation instead of allocating every step.
Runs that pass the checks give the same results, bit for bit.

Signed-off-by: Jae Hoon Seo <jaehoon.seo@inha.ac.kr>
The resolution check exempted a node in the water within 1 % of the
grid spacing of a grid line across the coarse axis. On a coarse axis
that spacing is the half-width, so the exemption could reach several
metres: under an oblique sea a node 9 m off y = 0 is already wrong in
phase by k 9 sin(beta), which the grid cannot represent, and the check
ran only at the start, while the sea sways the lines off the grid line
during the run. The hull's Morison members read the same grid and are
interpolated across the axis too, which CableDyn cannot see node by
node.

The check now stops the run (one warning under waveGridCheck warn)
whenever the grid has NX = 2 or NY = 2 under waves that vary along that
axis and the lines sample the grid in the water at all, and its message
lists those nodes by line. CD_WaveGrid_Off_Vertex, which only this
exemption used, is removed with its tests. The coupled check requires
that a line along y = 0 is now reported with the others.

Signed-off-by: Jae Hoon Seo <jaehoon.seo@inha.ac.kr>
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Dec 2, 2026 •

Copy link
Copy Markdown
Codex Review Summary: ✅ Completed

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

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-12-02T07:52:30.256967Z d5df272 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.

@SMI-Lab-Inha

Copy link
Copy Markdown
Owner Author

@codex review

@read-the-docs-community

read-the-docs-community Bot commented Dec 2, 2026 •

Copy link
Copy Markdown

📖 7 files modified


Preview · build overview · CableDyn · built Dec. 2, 2026, 7:50 a.m. UTC

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: c09e755522

ℹ️ 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".

Comment thread src/openfast/CableDyn_OF.f90 Resolved
For externally supplied wave kinematics (SeaState WaveMod 6) the guard
took the sea's direction from WaveDir, which SeaState does not use in
that mode: the heading lives in the supplied grid data. A valid field
travelling along y on an NX = 2 grid then stopped at initialisation
because the unused WaveDir was 0, and a crossing field could pass on an
unrelated WaveDir.

With WaveMod 6 a coarse axis (NX or NY = 2) is now judged from the
supplied WaveVel and WaveAcc themselves: the run stops when they differ
between the three grid points across that axis by more than 1e-5 of
their largest magnitude, and a field that is the same along the axis
passes. A non-finite value counts as differing. The rule is a pure
function in CableDyn_WaveGrid (CD_WaveGrid_Field_Varies) with unit
tests, and the coupled guard script gains two WaveMod 6 cases written
from an Airy wave with WaveDir left at 0: at 30 deg on NY = 2 it stops
by default and runs with waveGridCheck warn, at 0 deg it runs.

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

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Swish!

Reviewed commit: d5df27290b

ℹ️ 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 ffb7b24 into dev Dec 2, 2026
22 checks passed
@SMI-Lab-Inha
SMI-Lab-Inha deleted the fix/wave-grid-guard branch December 3, 2026 06:54
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