Skip to content

HydroDyn/WAMIT: ignore zero-amplitude wave components in the .3 heading-range checks (fixes WaveMod=7 with PtfmRefY /= 0) - #3573

Draft
Sully2490 wants to merge 1 commit into
OpenFAST:devfrom
Sully2490:fix/hydrodyn-wamit-zero-amplitude-heading-check
Draft

Sully2490 wants to merge 1 commit into
OpenFAST:devfrom
Sully2490:fix/hydrodyn-wamit-zero-amplitude-heading-check

Conversation

@Sully2490

@Sully2490 Sully2490 commented Dec 4, 2026 •

Copy link
Copy Markdown

Opened as a draft because GitHub wouldn't let me open it as a regular PR. It's ready for review from my side. One file, +13/-2 lines.

Feature or improvement description

Bug fix in WAMIT_Init (modules/hydrodyn/src/WAMIT.f90). With WaveMod=7, SeaState leaves every frequency bin that is not listed in the wave-component file (and always the zero-frequency bin) at zero amplitude and WaveDirArr = 0. With PtfmRefY /= 0, 0 deg can fall outside the .3 heading range shifted by PtfmRefY, and the heading checks stop the run with "does not cover the wave heading of 0 deg", although every component that carries energy is covered.

This PR:

  • skips bins whose complex amplitude WaveElevC0(1:2,I) is exactly zero in the initial heading-range check (CYCLE);
  • in the two per-frequency excitation loops (ExctnDisp=0 and ExctnDisp>0), when a bin is out of range and has exactly zero amplitude, interpolates it at HdroWvDir(1) instead of raising the fatal "Wave heading out of range." Its excitation is multiplied by the zero amplitude either way, and WaveExctnC / WaveExctnCGrid stay defined.

The test is an exact comparison with zero, not EqualRealNos, on purpose: unlisted bins are exactly zero, and any bin with a non-zero amplitude, however small, is checked as before. Every input that runs today gives bit-identical results. A genuinely out-of-range component is still fatal, and the message now names its direction instead of 0 deg.

The same pattern (skipping zero-amplitude bins) is what SeaState already does when it derives WaveDir from user components (Waves.f90, line 862).

Related issue, if one exists

Fixes #3569

Reproducer: repro_inputs.zip, attached in a comment on #3569 (synthetic inputs in v5.0.x and dev input formats, and a numpy-only check script; see README.txt inside).

Impacted areas of the software

HydroDyn, WAMIT module, first-order wave-excitation initialization (ExctnMod=1), only for bins with zero wave amplitude. In practice this affects WaveMod=7 and possibly other inputs that leave bins at zero amplitude with a default direction. Second-order loads (WAMIT2.f90, same check pattern at lines 5434-5442) are not changed here.

Additional supporting information

Excitation force at the component frequencies (6 DOF, max relative complex error) from the HydroDyn driver output, double precision:

case v5.0.0 / dev stock with this patch (v5.0.0 / dev)
PtfmRefY=0, components at 5 and 25 deg (reference) runs runs, bit-identical
PtfmRefY=17, components at 22 and 42 deg FATAL ("0 deg") runs; matches the reference rotated by 17 deg: 9.9e-9 / 1.6e-8
PtfmRefY=17, a component at 62 deg (out of range) FATAL ("0 deg") FATAL ("62 deg")
r-test hd_NBodyMod1/2/3 body layouts (4 bodies), WaveMod=7, PtfmRefY = 17 and -105 deg FATAL in all 6 runs; vs the rotated PtfmRefY=0 run 1.7e-7 to 2.9e-7; vs WaveMod=5 with the same directions 2.0e-7 to 4.5e-7
same layouts, PtfmRefY=0 runs bit-identical
out-of-range controls (100 deg with PtfmRefY=0; 62 deg with PtfmRefY=17; WaveMod=5 at 100 deg) FATAL FATAL, naming the real direction

I preferred this HydroDyn-side change over setting a direction for the unlisted bins in SeaState (UserWaves.f90), because WaveDirArr is shared through WaveField and written to summary outputs, and the HydroDyn change cannot alter any run that currently succeeds.

Generative AI usage

AI-assisted. I used an AI assistant (Grok Bot) for the source analysis, the synthetic reproducer and check scripts, and drafting the patch and this text. The patch was built and checked with the double-precision hydrodyn_driver (results above). I directed the work, reviewed the diff and the results, and I take responsibility for the change. Questions and review comments come to me.

Assisted by: Grok Bot (AI assistant)

Test results, if applicable

Suggested labels (I can't set labels from outside the org): Type: Bug, Module: HydroDyn.

…ng-range checks

With WaveMod=7, SeaState leaves every unlisted frequency bin (and the
zero-frequency bin) at zero amplitude and WaveDirArr = 0. With
PtfmRefY /= 0, 0 deg can fall outside the shifted .3 heading range and
the heading checks stopped the run although every component that carries
energy is covered. Skip exactly-zero bins in the initial check and
interpolate them at an in-range heading in the two per-frequency checks.
Bins with any non-zero amplitude are checked as before.

Fixes OpenFAST#3569

Assisted-by: Grok Bot
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