Repository navigation
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
Conversation
…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
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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). WithWaveMod=7, SeaState leaves every frequency bin that is not listed in the wave-component file (and always the zero-frequency bin) at zero amplitude andWaveDirArr = 0. WithPtfmRefY /= 0, 0 deg can fall outside the.3heading range shifted byPtfmRefY, 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:
WaveElevC0(1:2,I)is exactly zero in the initial heading-range check (CYCLE);ExctnDisp=0andExctnDisp>0), when a bin is out of range and has exactly zero amplitude, interpolates it atHdroWvDir(1)instead of raising the fatal "Wave heading out of range." Its excitation is multiplied by the zero amplitude either way, andWaveExctnC/WaveExctnCGridstay 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
WaveDirfrom 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; seeREADME.txtinside).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 affectsWaveMod=7and 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:
PtfmRefY=0, components at 5 and 25 deg (reference)PtfmRefY=17, components at 22 and 42 degPtfmRefY=17, a component at 62 deg (out of range)hd_NBodyMod1/2/3body layouts (4 bodies),WaveMod=7,PtfmRefY = 17and-105degPtfmRefY=0run 1.7e-7 to 2.9e-7; vsWaveMod=5with the same directions 2.0e-7 to 4.5e-7PtfmRefY=0PtfmRefY=0; 62 deg withPtfmRefY=17;WaveMod=5at 100 deg)I preferred this HydroDyn-side change over setting a direction for the unlisted bins in SeaState (
UserWaves.f90), becauseWaveDirArris shared throughWaveFieldand 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
2895884d), alone and together with the other three HydroDyn fixes I am proposing, and ondev(ab4e7424) together with them, with GNU Fortran 14.2.0,DOUBLE_PRECISION=ON, Release, Debian 13 x86_64. The patch is made againstdevand applies withgit apply --check; the same edit was applied to v5.0.0 for the v5.0.0 runs (only the error-message context line differs).hd_*r-test cases were run with this fix alone (v5.0.0 build) and compared channel by channel with a stock build made with the same compiler and flags: all 24 are bit-identical in every output channel. Together with my other three HydroDyn fixes (thetmpComplexArrallocation HydroDyn/WAMIT:tmpComplexArris never allocated, soExctnMod=2withNBodyMod=2and a non-zeroPtfmRefxt/PtfmRefytcrashes (SIGSEGV) #3567, theNBodyMod=2offset phase HydroDyn/WAMIT: withNBodyMod=2, the body-offset phase is applied at the WAMIT frequencies before interpolation, which gives large excitation errors between data frequencies #3570, and theExctnMod=2heading rotation HydroDyn/WAMIT:ExctnMod=2excitation force is not rotated byPtfmRefY(heading to inertial) asExctnMod=1is; which frame is intended for the.ssexctnoutput? #3571) onlyhd_NBodyMod2changes, because of the offset-phase fix. On dev I ran the synthetic reproducer decks only, not the r-tests.Suggested labels (I can't set labels from outside the org):
Type: Bug,Module: HydroDyn.